Last active
November 19, 2020 01:06
-
-
Save bokunodev/62a410c35c27204b7d6ca4a2b0325fd3 to your computer and use it in GitHub Desktop.
convert pdf file from RGB to CYMK using ghost script
This file contains 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
#!/usr/bin/bash | |
help(){ | |
echo "Usage: $0 <input.pdf> <output.pdf> [safe]" | |
echo "optional \`safe\` option, preform less processing, possibly better quality with a much larger file size." | |
exit 127 | |
} | |
if [[ $1 == "" ]] ; then | |
echo "Missing parameter input pdf file" | |
help | |
elif [[ $2 == "" ]] ; then | |
echo "Missing parameter output pdf file" | |
help | |
fi | |
case $3 in | |
"safe") | |
gs -dSAFER -dBATCH -dNOPAUSE -dNOCACHE -sDEVICE=pdfwrite -dAutoRotatePages=/None -sColorConversionStrategy=CMYK -dProcessColorModel=/DeviceCMYK -dAutoFilterColorImages=false -dAutoFilterGrayImages=false -dColorImageFilter=/FlateEncode -dGrayImageFilter=/FlateEncode -dDownsampleMonoImages=false -dDownsampleGrayImages=false -sOutputFile="$2" "$1" | |
;; | |
"") | |
gs -dSAFER -dBATCH -dNOPAUSE -dNOCACHE -sDEVICE=pdfwrite -dAutoRotatePages=/None -sColorConversionStrategy=CMYK -dProcessColorModel=/DeviceCMYK -sOutputFile="$2" "$1" | |
;; | |
*) | |
echo "Unknown parameter \`$3\`" | |
help | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment