+# guess at DPI, unless it's been set
+# the scans do not seem to accurately reflect their resolution.
+if [[ "$dpi" = "" ]]; then
+ # %k gives the number of colours/shades in the image.
+ # 2 for b/w, and the scanner seems to default to 400 dpi for that
+ # 256 for greyscale, which has to be selected manually (so I'm assuming 300 for no good reason)
+ # 31564 for colour, which defaults to 300
+ if [[ $( convert $file[0] -format "%k" info: || exit 1 ) == 2 ]]; then
+ dpi=400;
+ else
+ dpi=300
+ fi
+ if [[ $verbose == 1 ]]; then
+ echo "DPI guessed at $dpi."
+ fi
+fi
+
+# guess at depth, unless it's been set
+if [[ "$depth" = "" ]]; then
+ if [[ $( convert $file[0] -format "%k" info: || exit 1 ) == 2 ]]; then
+ depth=1;
+ else
+ depth=8
+ fi
+ if [[ $verbose == 1 ]]; then
+ echo "Depth guessed at $depth."
+ fi
+fi
+