I know this question has been answered in other threads, but none of the solutions worked for me. I have a pdf file which contains 4 plots with millions of colourful dots (Manhattan plots). The PDF file is so big (~100 MB) and I cannot even open it properly on my computer. I have tried gs and commands like

gs -sDEVICE=pdfwrite -dPDFSETTINGS=/ebook -q -o output.pdf manhattan_plots_long.pdf

but it seems that it does not work and I get an error message which says "Unable to convert color space to sRGB, reverting strategy to LeaveColorUnchanged."

I could find another code which fixes this error, but the new PDF file has the same size!

gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dNOPAUSE -dQUIET -dBATCH \
  -dAutoRotatePages=/None -dUseCIEColor -sOutputFile=output.pdf input.pdf

I do not understand what is wrong. Is there any solution for my problem?

  • 1
    Have you tried -dPDFSETTINGS=/screen?
    – DopeGhoti
    Commented Oct 26, 2017 at 19:52
  • @ DopeGhoti,yes. When I try with -dPDFSETTINGS=/screen I get the error message that I mentioned above.
    – Anna1364
    Commented Oct 26, 2017 at 20:05
  • Have you tried using the imagemagick convert tool? Commented Oct 26, 2017 at 22:42
  • Guess: the embedded images are too large, and most programs run into trouble handling them. Ideas: (1) Use pdftk or some other tool to extract single pages, and see if they render, so you can narrow down the problem. (2) Find another pdf with a simple image, make copy of your PDF, open copy in text editor that can handle large files (e.g. emacs), find the images and replace them with the simple image. Then fix xref table with pdftk. You'll probably need some understanding of the PDF format to fix the problem, anyway, and this way you can get some idea how it looks like.
    – dirkt
    Commented Oct 27, 2017 at 8:20
  • related question: How to analyze the space usage within pdf document?
    – milahu
    Commented Aug 19, 2023 at 12:21

3 Answers 3


Try adding -r150 to the second command, so

gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dNOPAUSE -dQUIET -dBATCH \ -dAutoRotatePages=/None -dUseCIEColor -r150 -sOutputFile=output.pdf input.pdf

You can play with numbers smaller than 150 to reduce image DPI.

Another option that can help is -dCompressFonts=true

  • GPL Ghostscript 10.01.1: Use of -dUseCIEColor detected! Since the release of version 9.11 of Ghostscript we recommend you do not set -dUseCIEColor with the pdfwrite/ps2write device family.
    – milahu
    Commented Aug 19, 2023 at 12:16

As I did not see the file, I can only guess that you have a highly detailed document intended for high-quality prints (e.g. large posters). The graphics are most likely vector graphics which ghostscript wants to conserve. Follow @Academiphile advice to have the document's individual pages rendered off-screen into adequately low resolution raster images:

ghostscript -dNOPAUSE -dBATCH -sDEVICE=tiffgray -sOutputFile=output.tif input.pdf

The resulting multi-page tif will be large, but you can proceed to view the images with a viewer of your choice. Please do not try to do anything else with that file (e.g. edit and give to print – the printer operator would be furious and/or suffer a mental breakdown).


I found that thread while looking for a solution to create some sort of alias where I could either modify a command before I execute it (e.g. populate) or use an alias with arguments. I ended up creating a function for it and I thought it could help other people looking for similar solutions. You can directly insert these type of function into your .bashrc file.

## Function to compress PDF
compress-high() {
    # compress pdf $2 into $1 using minimizing size
    gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH -sOutputFile=$1 $2

This specific example is using ghostscript to compress a pdf, $1 is the first argument and represent the name for the compressed pdf and $ is the second argument and represent the name for the input pdf that you want to compress. This could easily be adapted to other uses.

You must log in to answer this question.

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