Skip to main content

Convert Color PDF Scan To Monochrome

utilities pdf

Using ImageMagick convert utility
#

Convert program throws an error, unless you change security policy by adding this line to /etc/ImageMagick-6/policy.xml

<policy domain="coder" rights="read | write" pattern="PDF" />

Threshold percentage
#

Lower value allows more noise from non-white pixels, higher is more restrictive. Example:

convert -density 300 -threshold 70% 'rj my_input.pdf my_output.pdf

Alternative: Ghostscript
#

I got it working for converting color to greyscale, but not for conversion to black and white. Example:

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

Alternative: pdfcpu
#

Works with image files but not PDF or PS streams. Example:

pdfcpu import -- "gray:true" 'input.pdf' 'output.pdf'

Results in error:

input.pdf needs an image extension (.jpg, .jpeg, .png, .tif, .tiff, .webp)

Related

Pdfcpu Commands For Manipulating Pdf Files
utilities pdf
Install # Download and extract pdfcpu.
Print CSV Files To PDF With Weasyprint
utilities development pdf python css
CSV file converted to PDF, with variable column widths and footers Printing a CSV file as a nicely formatted table is easy if you import it first into a spreadsheet like Microsoft Excel or LibreOffice Calc.
Printing Text Files To PDF With Enscript
utilities pdf
Sometimes you want to print a text file and apply some fancy formatting – say, a header with page numbering, or printing two-pages per sheet to conserve paper.