Extra transparent pixels in converting from EPS to PNG

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
hassan.nabeel
Posts: 2
Joined: 2012-08-08T22:47:41-07:00
Authentication code: 67789

Extra transparent pixels in converting from EPS to PNG

Post by hassan.nabeel »

Hi,

I have a very simple file that i am trying to convert from EPS to PNG. IM is adding extra transparent pixels to top, bottom and left side of image.

If i convert it using adobe photoshop at 72 DPI it gives me a size of 433x433 image with no extra transparent area.

Here is the original image:
http://www.go2convert.com/uploaded/download/F71zXesV

Screen shot of image from photoshop
Image

Here is the screenshot from IM
Image
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Extra transparent pixels in converting from EPS to PNG

Post by fmw42 »

try adding +repage to your command to remove any possible virtual canvas
hassan.nabeel
Posts: 2
Joined: 2012-08-08T22:47:41-07:00
Authentication code: 67789

Re: Extra transparent pixels in converting from EPS to PNG

Post by hassan.nabeel »

fmw42 wrote:try adding +repage to your command to remove any possible virtual canvas
Thanks for the suggestion. I tried +repage but it didn't have any effect. I can do trim to the image but since its a generic part of the code where users will be uploading their files, so i can't rely on trimming the image.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Extra transparent pixels in converting from EPS to PNG

Post by fmw42 »

Your file is actually EPT format (encapsulated postscript with embedded tiff). Apparently IM is having some problem with that.

I get the same results that you do, namely, other viewers on my Mac (Mac Preview and GraphicConverter) have it cropped to a square.


I tried

convert EPT:gradientcircle.eps gradientcircle.png

But IM is seeing a bounding box in the verbose info: properties in the file, namely,

ps:HiResBoundingBox: 612x792+0+0

I would suggest that you report this to the bugs forum and get the IM developers to check it out.
flopsylove
Posts: 1
Joined: 2012-08-10T04:42:14-07:00
Authentication code: 67789

Re: Extra transparent pixels in converting from EPS to PNG

Post by flopsylove »

Any news on this bug yet? I have been having similar difficulties and can't find an answer on how to sort it anywhere :cry:
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Extra transparent pixels in converting from EPS to PNG

Post by magick »

ImageMagick scans Postscript looking for the bounding box. Your image includes a bounding box of
  • %%BoundingBox: 0 0 612 792
and that is what it uses for the page size. If you remove this extra bounding box from your Postscript, you get the expected results.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Extra transparent pixels in converting from EPS to PNG

Post by fmw42 »

magick wrote:ImageMagick scans Postscript looking for the bounding box. Your image includes a bounding box of
  • %%BoundingBox: 0 0 612 792
and that is what it uses for the page size. If you remove this extra bounding box from your Postscript, you get the expected results.
It is puzzling that -strip does not help this. I would have thought that perhaps -strip would have removed that.

I also tried

convert -comment "ps:HiResBoundingBox:" gradientcircle.eps gradientcircle.png

Can one override the bounding box entry like this? Have I made a mistake?
Post Reply