Prevent GIF animation when converting from multiple page PDF

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
znabela

Prevent GIF animation when converting from multiple page PDF

Post by znabela »

Hi,

I have been trying to convert a PDF to GIF as my experience is that GIF provides the smallest file size.

But the PDF contains multiple pages, that needs to be converted to seperate GIF files.

Situation is that we recieve a PDF from a supplier, where the content needs to be uploaded to an internal web page, but in an image format, that is small in size and download.

I have tried to convert to JPG at 75, even at a 50 compression level (-quality) but the ending image size is too big (about 270kb) and PNG results in a 240Kb file size, where the GIF usually ends up around 100kb at most.

I believe I can get a lower file size by converting to a 256 color depth, but have been unable to locate the appropriate switch for this (-colorspace or -depth did not work, or I am doing something wrong)

Command line:
convert -trim -density 150x150 -units pixelsperinch input.PDF output.gif

Ending result should be multiple .GIF output files just like when converting to JPG or PNG.

/Robert

PS: I tried several searches, but can only find results concerning animation creations, now how to -split into several .GIF files.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Prevent GIF animation when converting from multiple page PDF

Post by fmw42 »

try output_%d.gif to make multiple pages that are numbered

see http://www.imagemagick.org/Usage/files/#write_seq
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Prevent GIF animation when converting from multiple page PDF

Post by anthony »

Or add a +adjoin setting to tell IM to save images as separat files. Having a '%d' in the output filename sets that flag automatically and gives you more control. For example you can use %03d to generate 3 digit numbers (with zero padding).
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
znabela

Re: Prevent GIF animation when converting from multiple page PDF

Post by znabela »

This is exactly what I needed, thanks! Both of you!
Post Reply