Possible bug with convert eps to png

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
moldawe
Posts: 8
Joined: 2019-07-23T23:32:23-07:00
Authentication code: 1152

Possible bug with convert eps to png

Post by moldawe »

Hello guys,

with a current version of ImageMagick (6.9.10-56 Q16 x64 2019-07-21) I have following behavior. I convert this eps-file: https://people.sc.fsu.edu/~jburkardt/da ... matica.eps

using the convert program:
convert mathematica.eps mathematica.png

The result is that the graph is placed at the bottom to the left with a lot of white space above it. In our older version (6.8.9-8) we did not have this behavior.

Any ideas how I can avoid this behavior that the result will look like this image?
https://people.sc.fsu.edu/~jburkardt/da ... matica.png

Thanks
Viktor
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Possible bug with convert eps to png

Post by fmw42 »

Your PNG result looks fine to me. But when I use your command, it does get offset. I am using Ghostscript 9.25. What version of Ghostscript are you using?

You can use -trim to get rid of the excess.

Code: Select all

convert mathematica.eps -background white -flatten -trim +repage -bordercolor white -border 5 result.png
moldawe
Posts: 8
Joined: 2019-07-23T23:32:23-07:00
Authentication code: 1152

Re: Possible bug with convert eps to png

Post by moldawe »

Hi fmw42

The solution with -trim works fine, thank you!

Regards
moldawe
Posts: 8
Joined: 2019-07-23T23:32:23-07:00
Authentication code: 1152

Re: Possible bug with convert eps to png

Post by moldawe »

OK, tested several images - the solution doesn't work as the image size differs much, based on the input image. Will try a newer version of ImageMagick.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Possible bug with convert eps to png

Post by fmw42 »

In what way does it not work? Can you show an example where it does not work and what you would like to see.
moldawe
Posts: 8
Joined: 2019-07-23T23:32:23-07:00
Authentication code: 1152

Re: Possible bug with convert eps to png

Post by moldawe »

Thanks for reply!

My test is very easy. I just convert an eps-File without any parameters:

convert mathematica.eps mathematica_6-8-9-8_Q16.png
convert mathematica.eps mathematica_7-0-8-57_Q16.png

The results can be found here:
https://drive.google.com/drive/folders/ ... sp=sharing

The older version does it correct, the newer one adds a lot of space above it.

I've tried with trim, but this doesn't work either:
convert mathematica.eps -trim mathematica_7-0-8-57_Q16_trim.png
The png has other dimensions that the one converted with 6.8.9-8 version.

Thanks for your help!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Possible bug with convert eps to png

Post by fmw42 »

-trim will trim to the minimum bounding box of the object. I do not know what 6.8.9.8 did. So the resulting dimensions may be different.

I do not understand why the blank space is at the top. The dimensions of the file are clear from identify -verbose as 612x792. That is the size of the resulting PNG. There is no clip box or xmp profile to tell it otherwise. I can only surmise that the EPS has an embedded file, perhaps a PNG with a virtual canvas.

I think the IM developers will need to look at this further.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Possible bug with convert eps to png

Post by snibgo »

The rasterization is done by Ghostscript. What version of GS do you use? What is the GS command (run "convert" with "-verbose")?
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Possible bug with convert eps to png

Post by fmw42 »

The change occurred between 6.9.10.53 and 6.9.10.54. I tested both using GS 9.25
moldawe
Posts: 8
Joined: 2019-07-23T23:32:23-07:00
Authentication code: 1152

Re: Possible bug with convert eps to png

Post by moldawe »

OK, so using 6.9.10.53 will solve the problem, right? We will try this option.

Thanks for your help!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Possible bug with convert eps to png

Post by fmw42 »

6.9.10.53 worked for me on Mac OSX Sierra, but not 6.9.10.54
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Possible bug with convert eps to png

Post by fmw42 »

Using 6.9.10.57, identify -verbose says: Geometry: 612x792+0+0

But in 6.9.10.53 identify -verbose says: Geometry: 288x178+0+0

So something change in getting the file size from the same version of Ghostscript or how ImageMagick gets it from Ghostscript or reports it in identify -verbose.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Possible bug with convert eps to png

Post by magick »

Thanks for the problem report. We can reproduce it and will have a patch to fix it in GIT master branch @ https://github.com/ImageMagick/ImageMagick later today. The patch will be available in the beta releases of ImageMagick @ https://www.imagemagick.org/download/beta/ by sometime tomorrow.
Post Reply