diff --git a/README.md b/README.md index 202b263..230ddcc 100644 --- a/README.md +++ b/README.md @@ -111,6 +111,7 @@ You can configure the tool via environment variables: | RENAME_GUI_SCANTOEMAIL="Scan rear pages" | optional | renames GUI button "Scan to email" to "Scan rear pages" | | RENAME_GUI_SCANTOIMAGE="Scan photo" | optional | renames GUI button "Scan to image" to "Scan photo" | | RENAME_GUI_SCANTOOCR="Scan High-Res" | optional | renames GUI button "Scan to OCR" to "Scan High-Res" | +| USE_JPEG_COMPRESSION | optional | use JPEG compression when creating PDFs | ### FTPS upload In addition to the storage in the mounted volume, you can use FTPS (Secure FTP) Upload. @@ -237,4 +238,4 @@ This way you can customize the actions running on your scanner. Hint: These scripts don't necessarily need to do scanning tasks. You can add any shell script here. -You may mount the scripts in this repository like this: ```-v "$PWD/script/:/opt/brother/scanner/brscan-skey/script/"``` \ No newline at end of file +You may mount the scripts in this repository like this: ```-v "$PWD/script/:/opt/brother/scanner/brscan-skey/script/"``` diff --git a/script/scanRear.sh b/script/scanRear.sh index 3901ee0..4533ed6 100755 --- a/script/scanRear.sh +++ b/script/scanRear.sh @@ -10,6 +10,13 @@ if [[ $RESOLUTION ]]; then else resolution=300 fi + +if [ "$USE_JPEG_COMPRESSION" = "true" ]; then + compression_flag="-compress JPEG -quality 80" +else + compression_flag="" +fi + device=$1 cd /scans date=$(ls -rd */ | grep $(date +"%Y-%m-%d") | head -1) @@ -66,7 +73,7 @@ fi ( echo "converting to PDF for $date..." - gm convert -page A4+0+0 *.pnm /scans/$date.pdf + gm convert -page A4+0+0 $compression_flag *.pnm /scans/$date.pdf /opt/brother/scanner/brscan-skey/script/trigger_inotify.sh "${SSH_USER}" "${SSH_PASSWORD}" "${SSH_HOST}" "${SSH_PATH}" $date.pdf echo "cleaning up for $date..." diff --git a/script/scantofile-0.2.4-1.sh b/script/scantofile-0.2.4-1.sh index 076847d..49994b1 100755 --- a/script/scantofile-0.2.4-1.sh +++ b/script/scantofile-0.2.4-1.sh @@ -11,6 +11,13 @@ if [[ $RESOLUTION ]]; then else resolution=300 fi + +if [ "$USE_JPEG_COMPRESSION" = "true" ]; then + compression_flag="-compress JPEG -quality 80" +else + compression_flag="" +fi + device=$1 date=$(date +%Y-%m-%d-%H-%M-%S) @@ -49,7 +56,7 @@ fi ( echo "converting to PDF for $date..." - gm convert -page A4+0+0 $filename_base*.pnm /scans/$date.pdf + gm convert -page A4+0+0 $compression_flag $filename_base*.pnm /scans/$date.pdf /opt/brother/scanner/brscan-skey/script/trigger_inotify.sh "${SSH_USER}" "${SSH_PASSWORD}" "${SSH_HOST}" "${SSH_PATH}" $date.pdf echo "cleaning up for $date..."