I have a pdf (having multiple pages) containing some colorful certificates, and need a black and white (grayscale) version of it.

Is there any way to make it grayscale with a single command, or with any simple GUI program (preferably FOSS)?

In principle, I can open all the pages separately in GIMP, make them grayscale, and rejoin, but that would take a lot of effort.

  • 1
    Does this answer your question?
    – marcelm
    Dec 5, 2021 at 13:04
  • @marcelm Yes, this is what I have been looking for. Please write it into an answer. Dec 5, 2021 at 13:30
  • The answer already exists on the SE network; I linked to it. There would be no point in me reproducing it here.
    – marcelm
    Dec 6, 2021 at 10:30

4 Answers 4


A similar question and answer is there in Stack Overflow.

Convert has the great disadvantage of converting to bitmap images, whatever you do... Try this out:

gs -sOutputFile=outfile.pdf -sDEVICE=pdfwrite \
  -sColorConversionStrategy=Gray -dProcessColorModel=/DeviceGray \
  -dCompatibilityLevel=1.4 infile.pdf < /dev/null

You have to redirect from /dev/null because by default, gs is interactive. There is a host of options available to tune the output, you can look at the pdfwrite parameters of ghostscript.

In this method, the output pdf does not blow up in size, and also, its quality does not degrade.

  • Why </dev/null? Also, what is the difference between -dProcessColorModel and -sProcessColorModel? Dec 6, 2021 at 4:44
  • @ArchismanPanigrahi I've clarified a bit. The difference between -s and -d isn't entirely clear to me. -s defines a postscript string, but I'm not sure what the -d option does. Dec 6, 2021 at 12:42

One of the ways is to use ImageMagick with some scripting.

You have to try its convert program as follows for single document:

convert -grayscale average color-in.pdf grayscale-out.pdf

More details about possible options are presented in its man-page locally by man convert or online.

Note: you may get "not authorized" message which is fixable by following this Q&A.

  • 3
    +1 It works, but becomes blurry. I also tried -density 300. While it retains the quality, it turns a 1.4 MB PDF into 29 MB. Web services like pdfresizer.com/black-and-white can retain the size as well as the quality simultaneously. Something like this should be available in Ubuntu. Dec 4, 2021 at 21:39
  • With proper -density it gives nice grayscale. In case you need black/white with clean background it is more suitable -density 300 -threshold 75%. It may be useful when you keep original scans in color and want to reprint it.
    – x'ES
    Nov 7, 2023 at 15:50

Download GIMP and open your pdf file. It will ask for resolution. There you can enter number pixels or select pixel/in etc. Now just went to Image >> Mode >> Grayscale. That is your complete pdf file is converted to grayscale. Now Go to File >> Export As >> yourfilename.pdf and press export. Edit: If you have problem getting large size file. You can opt for following options(In toto you have to achieve minimum number of colors to reduce your file size. If you understand that you get the solution.)

Step 1: Image >> Mode >> Grayscale

Step 2: Image >> Mode >> Indexed >> Generate optimum palette(Here you will find 256 numbers of colors) >> change the Maximum number of colors to 10 or any other value that suits your file size.

Step 3: If you want to reduce the file size further. Than you can opt for this step.

Image >> Mode >> Indexed >> Generate optimum palette >> Here this time select for Use web-optimized palette.

Note even if you want small size color pdf you can skip the step 1.

The reason for large size of pdf is number of colors.

  • Same issue as in N0rbert's answer. Either image quality is poor, or if a higher DPI is used, the PDF becomes huge. Dec 6, 2021 at 13:04
  • Trust me I am using it on daily basis. I opted for Gimp after trying many methods. Yes gs, convert and other are options. For large files convert consume huge memory. With gs and gv you have to you have to hit and try. I was not able to get that good quality. I am giving you other options by editing my answer.
    – Ajay
    Dec 6, 2021 at 13:22

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .