diff options
author | Arun Isaac | 2016-12-21 02:21:54 +0530 |
---|---|---|
committer | Arun Isaac | 2016-12-21 02:21:54 +0530 |
commit | b3484b533476aa6d6263775b7a79670bc9eec70e (patch) | |
tree | b23b559f5aef54bcde689ee7307da762181dce9a /scan-images.sh | |
download | ksh-reports-b3484b533476aa6d6263775b7a79670bc9eec70e.tar.gz ksh-reports-b3484b533476aa6d6263775b7a79670bc9eec70e.tar.lz ksh-reports-b3484b533476aa6d6263775b7a79670bc9eec70e.zip |
Initial commit
Diffstat (limited to 'scan-images.sh')
-rwxr-xr-x | scan-images.sh | 19 |
1 files changed, 19 insertions, 0 deletions
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 |