Page 1 of 1
Possible bug with convert eps to png
Posted: 2019-07-25T22:26:58-07:00
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
Re: Possible bug with convert eps to png
Posted: 2019-07-25T22:49:32-07:00
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
Re: Possible bug with convert eps to png
Posted: 2019-07-26T02:44:09-07:00
by moldawe
Hi fmw42
The solution with -trim works fine, thank you!
Regards
Re: Possible bug with convert eps to png
Posted: 2019-07-30T06:02:20-07:00
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.
Re: Possible bug with convert eps to png
Posted: 2019-07-30T09:21:47-07:00
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.
Re: Possible bug with convert eps to png
Posted: 2019-07-31T08:33:26-07:00
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!
Re: Possible bug with convert eps to png
Posted: 2019-07-31T08:57:58-07:00
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.
Re: Possible bug with convert eps to png
Posted: 2019-07-31T09:06:03-07:00
by snibgo
The rasterization is done by Ghostscript. What version of GS do you use? What is the GS command (run "convert" with "-verbose")?
Re: Possible bug with convert eps to png
Posted: 2019-07-31T09:16:24-07:00
by fmw42
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
Posted: 2019-07-31T13:16:36-07:00
by moldawe
OK, so using 6.9.10.53 will solve the problem, right? We will try this option.
Thanks for your help!
Re: Possible bug with convert eps to png
Posted: 2019-07-31T15:02:15-07:00
by fmw42
6.9.10.53 worked for me on Mac OSX Sierra, but not 6.9.10.54
Re: Possible bug with convert eps to png
Posted: 2019-07-31T20:54:48-07:00
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.
Re: Possible bug with convert eps to png
Posted: 2019-08-03T04:30:47-07:00
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.