diff options
| author | A Farzat <a@farzat.xyz> | 2025-11-28 18:28:08 +0300 |
|---|---|---|
| committer | A Farzat <a@farzat.xyz> | 2025-11-28 18:28:08 +0300 |
| commit | 71cb7318d18b43fc2f1de6bac3a0c9435f4a18ba (patch) | |
| tree | d7f56658917f56a4ec04f03a9c3033d5db6db0f1 | |
| parent | e58812fa6ba1d213f18e8c78f3c8e42b8c6a88cd (diff) | |
| download | dotfiles-71cb7318d18b43fc2f1de6bac3a0c9435f4a18ba.tar.gz dotfiles-71cb7318d18b43fc2f1de6bac3a0c9435f4a18ba.zip | |
| -rwxr-xr-x | bin/tmp/turn_badge_to_2x2tiles.sh | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/bin/tmp/turn_badge_to_2x2tiles.sh b/bin/tmp/turn_badge_to_2x2tiles.sh new file mode 100755 index 0000000..cb57aff --- /dev/null +++ b/bin/tmp/turn_badge_to_2x2tiles.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env sh + +# Half the height and width of an image or pdf page by making it into 2x2 tiles. +# The first argument is the input file. Could be an image or a pdf. +# The second argument is the output filename. It is optional. Default is output.png. + +if [ "${1%.pdf}" != "$1" ]; then + img_name="$(mktemp --suffix=.png)" + magick -density 300 "${1}[0]" "$img_name" +else + img_name="$1" +fi + +if [ -n "$2" ]; then + output_file="$2" +else + output_file="output.png" +fi +montage "$img_name" "$img_name" "$img_name" "$img_name" -tile 2x2 -geometry +0+0 "$output_file" |
