Skip to content

Instantly share code, notes, and snippets.

@bencholmes
Created July 6, 2018 13:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bencholmes/d3f5dddad7669e5ebe30f94f9ed7a1f0 to your computer and use it in GitHub Desktop.
Save bencholmes/d3f5dddad7669e5ebe30f94f9ed7a1f0 to your computer and use it in GitHub Desktop.
Bash script to convert a PDF from colour to gray scale.
fileName=$(basename $1)
directory=$(dirname $1)
gs \
-sOutputFile="$directory/${fileName%.*}-grayscale.pdf" \
-sDEVICE=pdfwrite \
-sColorConversionStrategy=Gray \
-dProcessColorModel=/DeviceGray \
-dCompatibilityLevel=1.4 \
-dAutoRotatePages=/None \
-dNOPAUSE \
-dBATCH \
"$1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment