summaryrefslogtreecommitdiff
path: root/bin/tmp/turn_badge_to_2x2tiles.sh
blob: cb57affbde08d38835e03e87f4cab266ed19e821 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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"