From 71cb7318d18b43fc2f1de6bac3a0c9435f4a18ba Mon Sep 17 00:00:00 2001 From: A Farzat Date: Fri, 28 Nov 2025 18:28:08 +0300 Subject: Add a utility to resize badges before printing --- bin/tmp/turn_badge_to_2x2tiles.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 bin/tmp/turn_badge_to_2x2tiles.sh 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" -- cgit v1.2.3-70-g09d2