summaryrefslogtreecommitdiff
path: root/bin/tmp
diff options
context:
space:
mode:
Diffstat (limited to 'bin/tmp')
-rwxr-xr-xbin/tmp/turn_badge_to_2x2tiles.sh19
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"