Imagemagic convert producing wrong size image

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
undertruck

Imagemagic convert producing wrong size image

Post by undertruck »

Hi,

I've a one page PDf file named file.pdf, which has an image embedded in it. This 354x591 image was built with 300 DPI in Photoshop. Print size of the the document is 1.18 inch x 1.97 inch. Which is correct because 354/300 = 1.18 and 591/300 = 1.97.

Now problem is when I run
convert file.pdf file.jpg
, file.jpg is produced with 85x142 dimensions. Shouldn't the image be saved as 354x591, which was the original size in PDF?

I've tried it with all the switches like density, size, geometry and resize but in all cases, image is 85x142. I think the reason is while is producing image it is calculating pixel size from print size 1.18 inch x 1.97 inch with 72 DPI (1.18x72 = 85, 1.97x72=142). So it seems it's doing wrong calculation. Is it a known bug?

Could someone please help me on this?
undertruck

Re: Imagemagic convert producing wrong size image

Post by undertruck »

I got it working. combination of density and resize switches gave me desired output. But default convert should have produced the same result as well. I'm not sure if that's the way it is supposed to work.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Imagemagic convert producing wrong size image

Post by anthony »

I would love to be able to extract raster images from PDf files (or psotscript files) in a 1:1 pixel to pixel manner. However both these file formats are designed to be resolution independent, even though a raster image contained within them may have a specific 'preferred' resolution or density.

The result is that currently their is no way to extract the raster images from such files 'perfectly'. I would love to find a way to do so, but currently this is not possible, except by trial and error.

I would love to hear from anyone that can prove me wrong!
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply