Sunday 13 April 2014

imagemagick - a fast way to compress PDF files




Sometimes its useful to have a quick way to compress PDF files. I have found imagemagick contains a great command line tool 'convert'.

Background on imagemagick
  • Number of CLI tools to create and edit bitmap images 
  • Can read, convert and write images in many formats
  • Supports common formats e.g. PDF, JPEG, GIF and PNG

Convert CLI tool
  • Convert's between image formats 
  • Blur images
  • Crop images
  • Draw on images
  • Flip images
  • Also can resize an image among many other tasks
Installation
  • Install on Ubuntu or Linux Mint
$ sudo apt-get -y install imagemagick

Example

  • The following will compress the input.pds to output.pdf
$ convert -compress jpeg -density 100 input.pdf output.pdf

Further Information

$ man convert

No comments:

Post a Comment