Created
February 3, 2023 13:40
-
-
Save leeeeeeeee2/93c6bb4f7311399a6d9716d37e4c3508 to your computer and use it in GitHub Desktop.
convert pdf to tiff in 600 dpi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# from https://github.com/andrewpearce-digital/pdf2tiff/blob/master/pdf2tiff.sh | |
# Requires ghostscript | |
# ubuntu: sudo apt install ghostscript | |
FILECOUNT=0 | |
TOTALSTARTTIME=$(date +"%s") | |
#Get all pdfs in process folder | |
for f in *.pdf | |
do | |
#Catch Process start time to calcuate process length | |
STARTTIME=$(date +"%s") | |
echo "Converting PDF to TIFF - $f..." | |
name=$(echo $f | cut -f 1 -d '.') | |
#Use GhostScript to convert pdf to tiff, resolution is 300dpi, file format is TIFFlzw | |
gs -dBATCH -dNOPAUSE -sDEVICE=tiff24nc -sCompression=lzw -r600 -dCOLORSCREEN=false -dNOINTERPOLATE -dNOTRANSPARENCY -dUseFastColor=true -sOutputFile=$name.tiff $f | |
#Catch process end time | |
ENDTIME=$(date +"%s") | |
#Calculate time difference and print result | |
echo "processed $f to TIFF in $(($ENDTIME - $STARTTIME)) seconds" | |
FILECOUNT=$((FILECOUNT + 1)) | |
done | |
TOTALENDTIME=$(date +"%s") | |
echo "$FILECOUNT processed in $(($TOTALENDTIME - $TOTALSTARTTIME)) seconds" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment