3 # check_image_resolutions -- find image files with resolution != 144x144 dpi
4 # Copyright (C) 2009 The GIMP Documentation Team.
8 usage
="Usage: ${0##*/} DIR [DIR ...]"
9 programs
="find xargs identify awk"
17 # Check command line arguments
20 test -d "$arg" || die
65 "No such directory: $arg"
26 # Check for required programs
27 for prog
in $programs; do
28 type $prog >/dev
/null
2>&1 || die
69 "Missing program: $prog"
32 find "$@" -name .git
-prune \
33 -o \
( -name *.png
-o -name *.jpg \
) -print | \
34 xargs identify
-format "%d/%f %x %y %wx%h\n" | \
39 c[0]="|"; c[1]="/"; c[2]="-"; c[3]="\\";
40 print("Checking image files for potential resolution problems...");
43 # $1 - file name (incl. path)
44 # $2 - x resolution (ok: 56.69, 56.70, 143.*, 144.*)
45 # $3 - x units (e.g. "PixelsPerInch", "Undefined", ...)
48 # $6 - <width>x<height>
50 # path/to/image.png 56.69 PixelsPerCentimeter \
51 # 56.69 PixelsPerCentimeter 273x303
53 /./ && ($2 !~ /^(56\.|14[34])/ || $4 !~ /^(56|14[34])/) {
56 printf("%s (%s): %sx%s [%s]\n", $1, $6, $2, $4, $3)
58 printf("%s (%s): %s [%s]\n", $1, $6, $2, $3)
62 printf(" Total: %d Suspects: %d\n", n, m);