Page 1 of 1

Best command to convert EPS to PNG?

Posted: 2017-08-02T11:06:06-07:00
by fablau
Hello here,
I am trying to convert an EPS image to a PNG image with either convert, mogrify or any other command you may suggest. My problem is that I need to convert sheet music (so, no color needed), the image must be NOT aliased, at 224.993 dpi and size 1863x2636 and the size must be reasonable small.

To give you an example, here is a sample source file I use:

https://www.dropbox.com/s/2o4nzf6o2kb1x ... e.eps?dl=1

And here is the image I have converted manually with Photoshop (just imported without the Anti-aliased option checked, width of 1859, height of 2631 and resolution of 224.993 dpi, and a very small file:

https://www.dropbox.com/s/h1pou6eb3yw11 ... n.png?dl=1

I'd like to accomplish the same kind of destination file from the same source by using either convert, mogrify or whatever else you can suggest.

Thanks in advance to everybody!

Re: Best command to convert EPS to PNG?

Posted: 2017-08-02T14:16:33-07:00
by fmw42
Your image is CMYK black on transparency. So you need to convert to sRGB. So try this

Code: Select all

convert -colorspace sRGB -density 300 SinglePageSource.eps -background white -flatten -resize 1863x2636 -units pixelsperinch -density 224.993 SinglePageSource_im.png
or you may get higher quality, but slower processing if you do

Code: Select all

convert -colorspace sRGB -density 600 SinglePageSource.eps -background white -flatten -resize 1863x2636 -units pixelsperinch -density 224.993 SinglePageSource_im2.png

Re: Best command to convert EPS to PNG?

Posted: 2017-08-02T17:13:52-07:00
by fablau
Thank you for your suggestion, I get pretty good quality but nothing compared to what I can accomplish with Photoshop (see my sample png file above). How do you think I could achieve that kind of quality at such small file size? (just 57KB!)

Re: Best command to convert EPS to PNG?

Posted: 2017-08-02T17:24:16-07:00
by fmw42
My second result is better quality than your PS result. You can see that in my result the bars connecting notes are perfectly horizontal. In your PS result, some of the bars are stair-stepped. ImageMagick is using Ghostscript to read your EPS file. My GS version is 9.21. Perhaps you need to upgrade. The file size of your PS is smaller. To achieve a smaller result, you will need to take my result and use a PNG compression tool, such as listed at http://www.imagemagick.org/Usage/formats/#png_non-im. PNGCRUSH OR OPTIPNG, for example.

Re: Best command to convert EPS to PNG?

Posted: 2017-08-02T18:01:24-07:00
by fablau
You are right about the fact some note beamings are stair-stepped, but if you look at the staff lines they are much finer in the PS version, and all exactly 1 px high. In your version are all 3 pixels high and their are not all the same (grey colors differ from each other). Is there any way to accomplish that with Imagemagick?

Thank you again very much!

Re: Best command to convert EPS to PNG?

Posted: 2017-08-02T19:14:49-07:00
by fmw42
Look at the text on the left side of sheet. You will see that your PS results are aliased badly, whereas the ImageMagick result has smooth antialiased text.

Imagemagick used Ghostscript to read your image. That is where the results are achieved. GS must process it differently from PS. You can try using Ghostscript directly, but I do not know of any controls to set the note line width. The thicker lines is probably due the better antialiasing in the ImageMagick result.

You could use -morphology to thin the lines, but then it might do more damage than good.

You will have to decide on the pros and cons of both method.

Re: Best command to convert EPS to PNG?

Posted: 2017-08-03T09:52:00-07:00
by fablau
Thank you for your reply and help, I'll see what to do then.

Appreciated!