From eea2c495d93042e1b09a3a0e68b23d389dc0fc4e Mon Sep 17 00:00:00 2001 From: Raman Gupta Date: Wed, 19 Apr 2023 12:46:49 -0400 Subject: [PATCH] warn on deskew but no crop Best practices from the sane mailing list indicate that deskew should be used in combination with crop for best results. Warn if not doing so. --- scan | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/scan b/scan index c23dad2..f2246da 100755 --- a/scan +++ b/scan @@ -258,6 +258,13 @@ case "$SIZE" in esac +if [[ $DESKEW == 1 ]]; then + if [[ $CROP != 1 ]]; then + echo >&2 'Warning: `--deskew` specified, but `--crop` not specified. It is recommended to scan at max height/width and then crop to give deskew the best chance of working correctly.' + fi + DESKEW="--swdeskew=yes" +fi + if [[ $CROP != 1 && "$PGHEIGHT" != "" ]]; then PGHEIGHTIN=$(units --compact -1 "$PGHEIGHT mm" 'in') PGHEIGHT="--page-height $PGHEIGHT -y $PGHEIGHT" @@ -279,10 +286,6 @@ if [[ $CROP == 1 ]]; then PS2PDF_OPTS="-dEPSCrop" fi -if [[ $DESKEW == 1 ]]; then - DESKEW="--swdeskew=yes" -fi - if [[ $SKIP_EMPTY_PAGES == 1 && ! -x "$(command -v bc)" ]]; then echo >&2 'Warning: `--skip-empty-pages` specified, but `bc` not available. Disabling empty page detection.' SKIP_EMPTY_PAGES=0