#!/bin/sh # # Set the pixel aspect ratio of a TIFF file based on the image dimensions. # cmd=$(basename $0) if [ ! -f "$1" ]; then echo "$cmd: No such file" >&2; exit 1 fi res=$(tiffinfo "$1" | sed -n -E '/^ Image Width:/ { s/^.*: ([0-9]+).*: ([0-9]+).*$/\1x\2/ p }') case "$res" in 320x200) aspopt="-x 10 -y 12 -u 1";; 320x400) aspopt="-x 20 -y 12 -u 1";; 320x512) aspopt="-x 2 -y 1 -u 1";; 640x350) aspopt="-x 1000 -y 1371 -u 1";; 640x400) aspopt="-x 10 -y 12 -u 1";; *) exit;; esac tiffedit "$1" $aspopt .