Why -size option on convert command doesn't work?

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
Habsy
Posts: 2
Joined: 2012-06-02T17:59:42-07:00
Authentication code: 13

Why -size option on convert command doesn't work?

Post by Habsy »

I want to keep the original size of my image just converting its format. The following command should work, shouldn't it?
convert PTS01.pdf PTS01.gif

It doesn't apply the way I wanted it to. My PTS01.pdf image was resized and I can barely read what is written on it. I tried then to use the command -size (since I know the size of my original image) combined with the quality command:
convert -quality 100 -size 500x350 PTS01.pdf PTS01.gif

Why it doesn't work at all?
Thanks!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Why -size option on convert command doesn't work?

Post by fmw42 »

First, -size is a setting and does nothing by itself.

More importantly, PDF files have no resolution (density), because they are vector format. You need to assign a density before reading the PDF (nominally it would be 72 dpi). Plus to get better quality you need to "supersample", which means you have to make the pdf larger by using a larger density and then resize the result back down by the opposite ratio. That will make the processing slower but give you higher quality result.

try

convert -density 288 PTS01.pdf -resize 25% PTS01.gif

288=72*4
25%=100%/4
Habsy
Posts: 2
Joined: 2012-06-02T17:59:42-07:00
Authentication code: 13

Re: Why -size option on convert command doesn't work?

Post by Habsy »

Wonderful explanation! Thank you very much. :D
Post Reply