From b3484b533476aa6d6263775b7a79670bc9eec70e Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Wed, 21 Dec 2016 02:21:54 +0530 Subject: Initial commit --- scan-images.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 scan-images.sh (limited to 'scan-images.sh') diff --git a/scan-images.sh b/scan-images.sh new file mode 100755 index 0000000..b538cae --- /dev/null +++ b/scan-images.sh @@ -0,0 +1,19 @@ +#! /bin/bash -xe + +# Query user for directory containing the scan images +IMAGE_DIRECTORY=$(zenity --file-selection --directory --text="Choose folder with ultrasound images") + +# If dialog box was cancelled, exit and do nothing +if [[ -z $IMAGE_DIRECTORY ]] +then + exit +fi + +IMAGE_FILES=$(ls $IMAGE_DIRECTORY/*.tif) +IMAGE_WIDTH=$(identify -format "%w" $(ls $IMAGE_DIRECTORY/*.tif | head -n 1)) +MONTAGE_OUTFILE=$(mktemp --suffix=".pdf") + +# Create montage of scan images +montage -geometry $IMAGE_WIDTH -tile 2x3 $IMAGE_FILES $MONTAGE_OUTFILE +# Send to printer, and delete from memory +lpr -r -o sides=two-sided-long-edge -o fit-to-page -o page-left=72 -o page-right=72 $MONTAGE_OUTFILE -- cgit v1.2.3