aboutsummaryrefslogtreecommitdiff
path: root/icons/crop.sh
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2006-12-27 10:26:13 +0000
committerSimon Tatham <anakin@pobox.com>2006-12-27 10:26:13 +0000
commitd07eb2ea3a85913edb826a3e9c3ffc8abda71771 (patch)
treef9bd72ce6f4b92ccba9932667292baa4f72686e4 /icons/crop.sh
parent90e6864579d740a6df3bdbbcf3cbc42cc5181d82 (diff)
downloadpuzzles-d07eb2ea3a85913edb826a3e9c3ffc8abda71771.zip
puzzles-d07eb2ea3a85913edb826a3e9c3ffc8abda71771.tar.gz
puzzles-d07eb2ea3a85913edb826a3e9c3ffc8abda71771.tar.bz2
puzzles-d07eb2ea3a85913edb826a3e9c3ffc8abda71771.tar.xz
Improve the icon images by cropping selected pieces out of most of
the main screenshots. (A few, like Map, were perfect already.) In the process I've vertically reflected the puzzle shown in the Pattern save file, to bring a more interesting piece of it into the top left corner :-) [originally from svn r7019]
Diffstat (limited to 'icons/crop.sh')
-rwxr-xr-xicons/crop.sh37
1 files changed, 37 insertions, 0 deletions
diff --git a/icons/crop.sh b/icons/crop.sh
new file mode 100755
index 0000000..0d15d3c
--- /dev/null
+++ b/icons/crop.sh
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+# Crop one image into another, after first checking that the source
+# image has the expected size in pixels.
+#
+# This is used in the Puzzles icon build scripts to construct icons
+# which are zoomed in on a particular sub-area of the puzzle's
+# basic screenshot. This way I can define crop areas in pixels,
+# while not having to worry too much that if I adjust the source
+# puzzle so as to alter the layout the crop area might start
+# hitting the wrong bit of picture. Most layout changes I can
+# conveniently imagine will also alter the overall image size, so
+# this script will give a build error and alert me to the fact that
+# I need to fiddle with the icon makefile.
+
+infile="$1"
+outfile="$2"
+insize="$3"
+crop="$4"
+
+# Special case: if no input size or crop parameter was specified at
+# all, we just copy the input to the output file.
+
+if test $# -lt 3; then
+ cp "$infile" "$outfile"
+ exit 0
+fi
+
+# Check the input image size.
+realsize=`identify -format %wx%h "$infile"`
+if test "x$insize" != "x$realsize"; then
+ echo "crop.sh: '$infile' has wrong initial size: $realsize != $insize" >&2
+ exit 1
+fi
+
+# And crop.
+convert -crop "$crop" "$infile" "$outfile"