TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am a beginner in LaTeX, tentatively using it for industrial documents. I am working on a laboratory report containing little text and a large number of pictures. I prefer to leave the pictures at their native quality level for archival purposes and because a number of them get magnified by the elegant routines found at this link: How to create magnified subfigures and corresponding boxes for portions of a large image

I typically get a PDF file directly using pdflatex. The .pdf file I am working on contains 9 pages and has a size of 9000 KiB.

Post-processing the .pdf file with the routine below (launched from the same directory), and using the "prepress" option, I get a file size of about 6500 KiB, and 3500 KiB with the setting "printer".

I could not find any drop of quality with each of these two settings (there are two lower quality options available, "ebook", and "screen"), when printed on A3 paper with a 600 dpi laser printer, and I would like to get the "printer" quality natively (directly at the creation of the PDF files), in order to eliminate the post-processing operation. Is there a way to do this?

/usr/local/bin/gs -q  -dSAFER -dNOPAUSE -dBATCH -sDEVICE=pdfwrite 
  -PDFSETTINGS=/printer -sOUTPUTFILE=NameOfOutputFile.pdf  
  -f NameOfTargetFileToOptimize.pdf
share|improve this question
What file size unit is Ko? – Werner Jul 3 '12 at 18:15
In theory, you could change the compression level of pdflatex with \pdfminorversion=5 \pdfcompresslevel=9 \pdfobjcompresslevel=3 (i.e. maximum compression with PDF v1.5). However, I had tried that with my answer to How to make the PDFs produced by pdflatex smaller?, see the comments: The result basically was that this does by far not reach the compression one can achieve via the gs route. – Daniel Jul 3 '12 at 18:29
@Werner Ko is for Kilo Octet, French for kB (kiloByte). – ArTourter Jul 3 '12 at 18:33
up vote 2 down vote accepted

I would go for a dedicated image manipulation program and create a temporary low quality version of the images. Compressing and resizing a lot of images can be lengthy.

For instance, if you are under Linux, the following command will create for each foo.jpg file a new file foo_small.jpg, with jpeg quality set to 60 and at most 1M pixels.

for f in *.jpg; do echo $f; convert $f -quality 60 -resize @1000000 `basename $f .jpg`_small.jpg; done

This could be expanded to a real script handling also .JPG or .jpeg files, maybe using a fixed resize ratio (e.g. halving), storing the low quality version in a new subfolder, etc.

There are other programs that can batch process a number of images.


Just to make the link from the comment below clickable:

How to make the PDFs produced by pdflatex smaller

share|improve this answer
The idea of compressing the picture before the compilation is not extremely attractive. I have found a lot of useful information here, (and also in the white paper referenced at the bottom of the thread) paperhttp://tex.stackexchange.com/questions/18987/how-to-make-the-pdfs-produced-‌​by-pdflatex-smaller/19047#19047 – Yves Jul 3 '12 at 19:41

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.