diff options
author | xyz <gky44px1999@gmail.com> | 2023-10-23 22:16:29 -0700 |
---|---|---|
committer | xyz <gky44px1999@gmail.com> | 2023-10-23 22:16:29 -0700 |
commit | 28e4f59d9af025e4ca53d4653063162ba0210cc4 (patch) | |
tree | c09abfcb2117a5a860a19dd3d216acd0200414a4 /home/xyz/.local/bin/convwall | |
parent | 258b37a79afed83152f315d7e7139a274ca2e318 (diff) |
rm useless
Diffstat (limited to 'home/xyz/.local/bin/convwall')
-rwxr-xr-x | home/xyz/.local/bin/convwall | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/home/xyz/.local/bin/convwall b/home/xyz/.local/bin/convwall deleted file mode 100755 index dff9c43b..00000000 --- a/home/xyz/.local/bin/convwall +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh - -# target image aspect ratio -wratio=$SCR_WIDTH -hratio=$SCR_HEIGHT -# chop how much from center -chopnum=99% - -# my benchmark shows -ping is much faster than default -# https://github.com/ImageMagick/ImageMagick/issues/3183#issuecomment-800955241 -width=$(identify -ping -format '%w' "$1") -height=$(identify -ping -format '%h' "$1") - -ratio=$((wratio*100/hratio)) -dim=$((width*100/height)) - -if [ "$dim" -ne "$ratio" ]; then - if [ "$dim" -lt "$ratio" ]; then - chopgeom="${chopnum}x0" - width=$((height*wratio/hratio)) - else - chopgeom="0x$chopnum" - height=$((width*hratio/wratio)) - fi - # may throw error "sort: write failed: 'standard output': Broken pipe \n sort: write error" - # caused by head exit (or close stdin) before sort output complete, can ignore - # https://stackoverflow.com/questions/46202653/bash-error-in-sort-sort-write-failed-standard-output-broken-pipe - bgcolor=$(convert "$1" -gravity center -chop "$chopgeom" -define histogram:unique-colors=true -format %c histogram:info:- | sort -rn | head -n1 | awk \{print\ \$3\} | cut -c1-7) - # another approach is to use "$width" or "x$height" for geometry, current approach is more readable - convert "$1" -gravity center -background "$bgcolor" -extent "${width}x$height" "$2" -else - echo 'same aspect ratio, no need to convert' >&2 - exit 1 -fi |