Page 1 of 1

Convert and resize .eps to .png

Posted: 2015-11-22T09:20:13-07:00
by thatbradguy
I'm using this command and getting very jagged results.

Code: Select all

mogrify -format png *.EPS -resize 2475x3525 -units PixelsPerInch -density 300
The eps is a vector file, so I would expect better results. Any help?

Input: https://dl.dropboxusercontent.com/u/9391254/AG1.EPS
Output: https://dl.dropboxusercontent.com/u/9391254/AG1.png

Re: Convert and resize .eps to .png

Posted: 2015-11-22T11:31:21-07:00
by snibgo
I have no tools other than Ghostscript that can view the image. Do you have tools that suggest Ghostscript is wrong?

What makes you think the contents are vector? Looking at AG1.EPS with a text editor, it looks like a bitmap with no vector data. But I'm not an eps expert.

Re: Convert and resize .eps to .png

Posted: 2015-11-22T12:10:40-07:00
by fmw42
Have you tried to use convert on one image rather than mogrify? In convert -density should come right before reading a vector file such as eps (if it is really vector data). I think your upload has changed your data. When I download your input, IM identify says it is PDF not EPS and it looks the same to me as your output result. Perhaps you should zip your input and upload that.

Re: Convert and resize .eps to .png

Posted: 2015-11-22T14:40:34-07:00
by thatbradguy
First... thanks for the help.

Second... I can't even find the original source file so re-upload it so I've uploaded another from the same source and changed to using convert as suggested.

Code: Select all

convert -density 300 ES3pinstripes03bw.eps -units PixelsPerInch -resize 2475x3525 *.png
Input: https://dl.dropboxusercontent.com/u/939 ... es03bw.eps
Output: https://dl.dropboxusercontent.com/u/9391254/%2A.png

Now my output looks great as far as size and clarity. Two questions...

1. How can I get pngs with transparent backgrounds as output?
2. How can I run this command on all the files in a directory, or even better, recursively through subdirectories?

Re: Convert and resize .eps to .png

Posted: 2015-11-22T16:39:28-07:00
by fmw42
I am not an expert on wild cards, but as far as I know, you cannot use *.png as an output name. You must specify a real name for the output file.

1) try

Code: Select all

convert -density 300 ES3pinstripes03bw.eps -units PixelsPerInch -resize 2475x3525 PNG32:ES3pinstripes03bw.png
2) you will have to write a script loop for whatever OS you are using to transverse the folder hierarchy and process each file as above.

Note that PNG does not allow PixelsPerInch, only PixelsPerCentimeter. But IM will convert it automatically.

Re: Convert and resize .eps to .png

Posted: 2015-11-22T19:26:14-07:00
by thatbradguy
Your suggested code doesn't give me transparent background.

Re: Convert and resize .eps to .png

Posted: 2015-11-22T19:44:25-07:00
by fmw42
Can you post the real input EPS? What I downloaded was just PDF from your link. It may be being converted from EPS to PDF when you upload to dropbox. Perhaps zip compress the EPS first and then upload it to dropbox. Is the EPS file actually transparent?

try

Code: Select all

convert -density 300 -background transparent ES3pinstripes03bw.eps -units PixelsPerInch -resize 2475x3525 PNG32:ES3pinstripes03bw.png

Re: Convert and resize .eps to .png

Posted: 2015-11-23T07:29:48-07:00
by thatbradguy
Here is the input all zipped up. - https://dl.dropboxusercontent.com/u/939 ... bw.eps.zip

As to its transparency, when I open it in illustrator it shows up on a white background. When I open it in Photoshop it has a transparent background. So... I'm not sure.

Re: Convert and resize .eps to .png

Posted: 2015-11-23T10:57:30-07:00
by fmw42
Your EPS file is in CMYK colorspace. You need to convert it to sRGB before processing it. This command works fine for me on IM 6.9.2.6 Q16 Mac OSX.

Code: Select all

convert -density 300 -colorspace sRGB -background transparent ES3pinstripes03bw.eps -units PixelsPerInch -resize 2475x3525 PNG32:ES3pinstripes03bw.png

Re: Convert and resize .eps to .png

Posted: 2015-11-23T11:47:41-07:00
by thatbradguy
That worked! Thanks. Now to write a script to process through all of these files.

Re: Convert and resize .eps to .png

Posted: 2015-11-23T11:57:04-07:00
by fmw42
try mogrify

Code: Select all

mogrify -format png -density 300 -colorspace sRGB -background transparent -units PixelsPerInch -resize 2475x3525 *.eps
It works for me.