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 » 2019-07-25T22:26:58-07:00

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: 25757
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 » 2019-07-25T22:49:32-07:00

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 » 2019-07-26T02:44:09-07:00

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 » 2019-07-30T06:02:20-07:00

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: 25757
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 » 2019-07-30T09:21:47-07:00

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 » 2019-07-31T08:33:26-07:00

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: 25757
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 » 2019-07-31T08:57:58-07:00

-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: 12429
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 » 2019-07-31T09:06:03-07:00

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: 25757
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 » 2019-07-31T09:16:24-07:00

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 » 2019-07-31T13:16:36-07:00

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: 25757
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 » 2019-07-31T15:02:15-07:00

6.9.10.53 worked for me on Mac OSX Sierra, but not 6.9.10.54

User avatar
fmw42
Posts: 25757
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 » 2019-07-31T20:54:48-07:00

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: 11098
Joined: 2003-05-31T11:32:55-07:00

Re: Possible bug with convert eps to png

Post by magick » 2019-08-03T04:30:47-07:00

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