PDF downsampling

Researching implies producing lots of PDF’s. Sometimes these PDF’s are exported without much control and become several MB large, which is inconvenient to send out to some else (e-mail) or even to the cloud or a printer. To deal with this issue, a common solution is to down sample the images in your PDF to a lower DPI value (reducing the number of pixels per square inch). If the target of the document is a handout paper (A4 or Letter size), 300 dpi is usually enough. But you might want to go even lower if the purpose is only screen-reading (150 or 150 dpi).

The industry standard software to fulfil this task is Adobe Acrobat or Adobe Distiller, but there are free options. One of those is using Ghostscript, a free set of tools widely used in the scientific community. After you install, run this command in OS X  Terminal, replacing “input.pdf” with your own target file. Remember that drag ‘n dropping a file into the terminal will immediately write its path. The output will be in your home folder under the name “downsampled.pdf”.

gs \
  -o downsampled.pdf \
  -sDEVICE=pdfwrite \
  -dDownsampleColorImages=true \
  -dDownsampleGrayImages=true \
  -dDownsampleMonoImages=true \
  -dColorImageResolution=72 \
  -dGrayImageResolution=72 \
  -dMonoImageResolution=72 \
  -dColorImageDownsampleThreshold=1.0 \
  -dGrayImageDownsampleThreshold=1.0 \
  -dMonoImageDownsampleThreshold=1.0 \

This code was borrowed from Kurt Pfeife.

All content © Copyright 2018 by Pedro de Azambuja Varela.
Subscribe to RSS Feed