Possible bug with convert eps to png
Possible bug with convert eps to png
Hello guys,
with a current version of ImageMagick (6.9.1056 Q16 x64 20190721) I have following behavior. I convert this epsfile: 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.98) 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
with a current version of ImageMagick (6.9.1056 Q16 x64 20190721) I have following behavior. I convert this epsfile: 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.98) 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
 fmw42
 Posts: 25757
 Joined: 20070702T17:14:5107:00
 Authentication code: 1152
 Location: Sunnyvale, California, USA
Re: Possible bug with convert eps to png
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.
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
Re: Possible bug with convert eps to png
Hi fmw42
The solution with trim works fine, thank you!
Regards
The solution with trim works fine, thank you!
Regards
Re: Possible bug with convert eps to png
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.
 fmw42
 Posts: 25757
 Joined: 20070702T17:14:5107:00
 Authentication code: 1152
 Location: Sunnyvale, California, USA
Re: Possible bug with convert eps to png
In what way does it not work? Can you show an example where it does not work and what you would like to see.
Re: Possible bug with convert eps to png
Thanks for reply!
My test is very easy. I just convert an epsFile without any parameters:
convert mathematica.eps mathematica_6898_Q16.png
convert mathematica.eps mathematica_70857_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_70857_Q16_trim.png
The png has other dimensions that the one converted with 6.8.98 version.
Thanks for your help!
My test is very easy. I just convert an epsFile without any parameters:
convert mathematica.eps mathematica_6898_Q16.png
convert mathematica.eps mathematica_70857_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_70857_Q16_trim.png
The png has other dimensions that the one converted with 6.8.98 version.
Thanks for your help!
 fmw42
 Posts: 25757
 Joined: 20070702T17:14:5107:00
 Authentication code: 1152
 Location: Sunnyvale, California, USA
Re: Possible bug with convert eps to png
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.
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.

 Posts: 12429
 Joined: 20100123T23:01:3307:00
 Authentication code: 1151
 Location: England, UK
Re: Possible bug with convert eps to png
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
 fmw42
 Posts: 25757
 Joined: 20070702T17:14:5107:00
 Authentication code: 1152
 Location: Sunnyvale, California, USA
Re: Possible bug with convert eps to png
The change occurred between 6.9.10.53 and 6.9.10.54. I tested both using GS 9.25
Re: Possible bug with convert eps to png
OK, so using 6.9.10.53 will solve the problem, right? We will try this option.
Thanks for your help!
Thanks for your help!
 fmw42
 Posts: 25757
 Joined: 20070702T17:14:5107:00
 Authentication code: 1152
 Location: Sunnyvale, California, USA
Re: Possible bug with convert eps to png
6.9.10.53 worked for me on Mac OSX Sierra, but not 6.9.10.54
 fmw42
 Posts: 25757
 Joined: 20070702T17:14:5107:00
 Authentication code: 1152
 Location: Sunnyvale, California, USA
Re: Possible bug with convert eps to png
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.
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.
Re: Possible bug with convert eps to png
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.