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.
7Convert will actually rasterize the contents of the pdf. So unless the pdf already encapsulates only raster images (e.g. a scanned document), this approach is a big no-no. – m000 – 2014-09-19T12:24:09.633
2Unless you use
-density 400 -quality 100
parameters - that works well – burtek – 2015-12-13T20:51:47.1972Really, is there anything ImageMagick can't do? :) – BalinKingOfMoria Reinstate CMs – 2017-08-18T03:02:16.943
-density 400 -quality 100
creates HUGE files. +1 for @goyinux's solution. – Stanimir Stoyanov – 2018-06-27T10:45:13.513The big files print great (only using black toner) while the original and gs-converted file use all toners and create a vague mess on my printer. – rew – 2019-01-10T11:59:35.963
What's the reason for
convert
to reduce the quality of rasterized images? I tried using the optionsconvert -density 300 -quality 100
, in order to prevent this behaviour ofconvert
. But the quality of the output image is still much worse than the quality of the input image... so are there options forconvert
, that prevent the encapsulated images from quality loss, when convertingpdf
'-files encapsulating rasterized images? – Arch Linux Tux – 2019-04-30T16:45:03.07028That significantly reduces quality. @goyinux' solution is better. – Johannes Weiss – 2013-02-12T16:41:00.863