108

I have a colour PDF file, and I'm going to print it out and then photocopy it in black and white. I'd like to know what it's like in B&W before photocopying it. Is it possible to 'greyscale' a PDF on the command line using free software? I'm using Ubuntu 9.10.

Amandasaurus
  • 2,037

4 Answers4

220

Better:

gs \
 -sOutputFile=output.pdf \
 -sDEVICE=pdfwrite \
 -sColorConversionStrategy=Gray \
 -dProcessColorModel=/DeviceGray \
 -dCompatibilityLevel=1.4 \
 -dNOPAUSE \
 -dBATCH \
 input.pdf
Eroen
  • 6,561
41

ImageMagick can do this.

convert -colorspace GRAY color.pdf gray.pdf

via this email

Iain
  • 4,786
16

Here’s a little script which in addition to the grayscale conversion can concatenate multiple input files. To use the script, put the following lines in a file, e.g. "convert2gray.sh"

#!/bin/bash
gs -sOutputFile=converted.pdf -sDEVICE=pdfwrite -sColorConversionStrategy=Gray -dProcessColorModel=/DeviceGray -dCompatibiltyLevel=1.4 -dNOPAUSE -dBATCH $@

and make it executable

chmod +x convert2gray.sh

Then

./convert2gray.sh input1.pdf input2.pdf … lastinput.pdf

will produce a single PDF "converted.pdf", which contains all pages from the input files converted to grayscale.

I had to print out mutliple files all in grayscale and found this the easiest way, since you can print out everything after inpection with one command.

ysis
  • 161
0

In my case I am keeping signed document scans in color, but need reprint it without gray noice. For this case works well

convert -density 300 -threshold 75% input.pdf output.pdf

(based on the answer)

Range between 50%-75% works fine in circumstances when you have color scan PDF (text as image) with original resolution 300dpi.

In case of text saved as PDF (not image) you will get huge increasing of output file size.

x'ES
  • 101