Skip to main content

Conversions

Grayscale (GS)

gs \
 -sOutputFile=output.pdf \
 -sDEVICE=pdfwrite \
 -sColorConversionStrategy=Gray \
 -dProcessColorModel=/DeviceGray \
 -dCompatibilityLevel=1.4 \
 -dNOPAUSE \
 -dBATCH \
 input.pdf

Optimisation (GS)

gs \
 -o output.pdf \
 -dNOPAUSE \
 -dBATCH \
 -sDEVICE=pdfwrite \
 -dCompatibilityLevel=1.4 \
 -dPDFSETTINGS=/printer \
 -sPAPERSIZE=a4 \
 -dFIXEDMEDIA \
 -dCompressPages=true \
 input.pdf

Remove alpha (IM)

convert -density 300 -background white -alpha remove (-alpha off) IN.pdf OUT.pdf

+ -flatten 😻

References:

https://legacy.imagemagick.org/Usage/masking/#alpha_remove

https://www.imagemagick.org/script/command-line-options.php#layers