Extra pixel while converting

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
deepeshsp
Posts: 6
Joined: 2013-07-25T23:55:41-07:00
Authentication code: 6789

Extra pixel while converting

Post by deepeshsp »

Hi,

I have a eps file, and when I open it in Adobe Illustrator, it says the image is of width 1001.937px and height 1000.03px.

When i simply convert it to a jpg using convert.exe of ImageMagick, (eg: convert.exe a.eps a.jpg), I get an image of 1002 X 1001 px

Please note that the height 1000.03 rounded to 1001, and because of this, I am getting an extra white colored space at the top of the jpg file,

How can I avoid this? Please help.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Extra pixel while converting

Post by fmw42 »

Get the dimensions from Adobe and round or truncate as needed.

convert image.eps -crop 1002x1000+0+0 +repage image.jpg

the +repage would be needed to remove the virtual canvas, but jpg does not support it, so you can leave it off. But it would be needed for PNG or GIF, for example.
deepeshsp
Posts: 6
Joined: 2013-07-25T23:55:41-07:00
Authentication code: 6789

Re: Extra pixel while converting

Post by deepeshsp »

Thanks for the reply. that worked well.

But I am automating this process, so I wont be able to know if I have to crop or not.

What I need is force the convert to round the input, ie, 1000.03 to 1000 and 1000.53 to 1001. Is there anyway I can do that?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Extra pixel while converting

Post by fmw42 »

Is the Adobe size information available for external computer access? It probably comes from the dpi setting converted to pixels given some dimension in inches for the output. If you can access any of that, you can compute the size and do your own rounding in an IM variable calculation.

See what information is available from

identify -verbose yourimage.pdf

That kind of information may be there for you. Can you post either your image or the verbose information?
Post Reply