Resize pdf and retain quality

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
nicky
Posts: 3
Joined: 2014-10-19T20:38:51-07:00
Authentication code: 6789

Resize pdf and retain quality

Post by nicky »

I need to compress a bunch of pdf files (size between 10MB to 50MB) to smaller size, say half of the original, but I need to remain the text quality.

I tried with the code below:

Code: Select all

convert -density 50 -compress zip input.pdf output.pdf
It does compress to smaller size, but the fonts are very blur.

If i increase the density, the output size become bigger than original size.

I have also tried with -resize and -resample, but the output size always bigger than the original, and yet the texts are blur.

What did I miss in the command?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Resize pdf and retain quality

Post by snibgo »

IM will rasterize the PDF pages. That is, it converts (vector) text like "abc" into loads of dots, at whatever resolution you specify. If your PDF is vector text, this is almost certain to increase the file size.
snibgo's IM pages: im.snibgo.com
nicky
Posts: 3
Joined: 2014-10-19T20:38:51-07:00
Authentication code: 6789

Re: Resize pdf and retain quality

Post by nicky »

sorry for I am new to IM and not too familiar with the command. If that's the case, does it means that IM is not too suitable in compressing pdf file?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Resize pdf and retain quality

Post by snibgo »

If the PDF contains vector data, IM is not a good tool for shrinking the file size.
snibgo's IM pages: im.snibgo.com
nicky
Posts: 3
Joined: 2014-10-19T20:38:51-07:00
Authentication code: 6789

Re: Resize pdf and retain quality

Post by nicky »

The pdf file contains vector data together with images, guess I'll need to find an alternative to compress it. Alright, thanks snibgo.
Post Reply