How to Convert a GIF to portrait/letter PDF & on half page

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
nileshavhad
Posts: 1
Joined: 2012-08-29T01:37:33-07:00
Authentication code: 67789

How to Convert a GIF to portrait/letter PDF & on half page

Post by nileshavhad »

How can I convert a 1400x800 GIF to a PDF that is Portait/Letter format & image is placed on top half of PDFs page.

I have a image of dimension 1400x800, which I need to convert to a PDF so that the PDF is in in Portrait form & contains the image in top/bottom half of the page. I need to use ImageMagick 6.4.8 2009-09-21 as that is the only available on my production server. Cannot use Ghostscript.

Image Details

Code: Select all

>identify sample.gif
sample.gif GIF 1400x800 1400x800+0+0 8-bit PseudoClass 256c 29.3kb 
I have tried all the options that I found out & nothing works. It always converts to a Landscape with the image occupying the complete page.
Here are some of the options that I tried:

Code: Select all

convert -bordercolor none -border 100x100 -page Letter -density 72 sample.gif -resize 792x612\! sample.pdf

convert -bordercolor none -border 100x100 -page Letter -density 72 sample.gif -resize 612x792\! sample.pdf

convert -density 72 -size 1400x800 sample.gif -page Letter -density 72 -resize 504x288 -bordercolor none -border 11%x14% sample.pdf
and many such combinations, but nothing works. I use -resize 612x792 so that its letter size, but then the image also gets stretched vertically. Is it possible to achieve what I am trying to, what options am I missing?

Note: I have to do this in a program so need a command based solution using convert.
Post Reply