Convert EPS with Mac Preview to PNG

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
sma71
Posts: 8
Joined: 2011-11-17T08:53:26-07:00
Authentication code: 8675308

Convert EPS with Mac Preview to PNG

Post by sma71 »

I am trying to figure out how I can take an EPS created in Photoshop and saved with a Mac preview and convert to PNG.

This is the error I get when running "convert previewMac.eps previewMac.png"

convert: Postscript delegate failed `previewMAC.eps': No such file or directory @ error/ps.c/ReadPSImage/807.
convert: missing an image filename `previewMAC.jpg' @ error/convert.c/ConvertImageCommand/3016.

If I run it with the same image saved with a TIFF preview it works fine.

I am running version 6.7.3-2 on OSX Lion
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Convert EPS with Mac Preview to PNG

Post by fmw42 »

I am not an expert on eps files. But what do you mean by created in Photoshop and saved with Preview. Are you saying you reopened the file in Preview and saved it again? Why? Was the Photoshop file not eps?

In general, you should probably post a link to your image so others could test.

The funny thing is you are getting a jpeg error and you are not using jpg for either your input or output. Did you imbed a jpeg into your Photoshop file?

Check your delegate libraries to see that you have ghostscript and png and jpg defined.

convert -list configure

then look at the line starting with DELEGATES and see if it contains gs, png, jpg, tiff
sma71
Posts: 8
Joined: 2011-11-17T08:53:26-07:00
Authentication code: 8675308

Re: Convert EPS with Mac Preview to PNG

Post by sma71 »

HI have reinstalled ghostscript and imagemagick and error has gone away when converting EPS to PNG, but I cannot figure out how to get a transparent background with this type of file that will be supplied to me.

Sample file located here: http://www.mediafire.com/file/o53yp2lt7 ... o_1bit.eps
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Convert EPS with Mac Preview to PNG

Post by fmw42 »

I am not sure why these do not work (IM 6.7.3.10 Q16 Mac OSX Snow Leopard) with or without the -type palettematte

convert 1SampleLogo_1bit.eps -transparent white -type palettematte PNG8:1SampleLogo_1bit.png

convert 1SampleLogo_1bit.eps -transparent white -type palettematte PNG32:1SampleLogo_1bit.png

However these work.

convert 1SampleLogo_1bit.eps png:- | convert - -transparent white PNG32:1SampleLogo_1bit.png

convert 1SampleLogo_1bit.eps png:- | convert - -transparent white PNG8:1SampleLogo_1bit.png
sma71
Posts: 8
Joined: 2011-11-17T08:53:26-07:00
Authentication code: 8675308

Re: Convert EPS with Mac Preview to PNG

Post by sma71 »

Can you explain what is happening with the versions that seem to be working? I am not following the syntax with those.

Thanks!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Convert EPS with Mac Preview to PNG

Post by fmw42 »

sma71 wrote:Can you explain what is happening with the versions that seem to be working? I am not following the syntax with those.

Thanks!

Code: Select all

convert 1SampleLogo_1bit.eps png:- | convert - -transparent white PNG32:1SampleLogo_1bit.png

convert 1SampleLogo_1bit.eps png:- | convert - -transparent white PNG8:1SampleLogo_1bit.png
I cannot really explain why these are working and the more direct ones do not.

What I am doing here is writing a temporary png file to standard out. Then piping it to another convert as standard in and processing from png to png format rather than directly from eps to png. So I am converting from eps to png, then making the png transparent and saving that as png again.
sma71
Posts: 8
Joined: 2011-11-17T08:53:26-07:00
Authentication code: 8675308

Re: Convert EPS with Mac Preview to PNG

Post by sma71 »

Yeah, that is strange that it will convert from the PNG as temp, but not as a straight convert. I guess I can use this for now, thanks for your insight into getting this working.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Convert EPS with Mac Preview to PNG

Post by fmw42 »

sma71 wrote:Yeah, that is strange that it will convert from the PNG as temp, but not as a straight convert. I guess I can use this for now, thanks for your insight into getting this working.

I have sent PM to the PNG developer, but so far he has not opened my messages to look at this issue.
sma71
Posts: 8
Joined: 2011-11-17T08:53:26-07:00
Authentication code: 8675308

Re: Convert EPS with Mac Preview to PNG

Post by sma71 »

great, thanks. Please post any new developments in this area if you get a response.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Convert EPS with Mac Preview to PNG

Post by fmw42 »

sma71 wrote:great, thanks. Please post any new developments in this area if you get a response.

He will most likely post here himself when he gets the messages with whatever he can contribute about this.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Convert EPS with Mac Preview to PNG

Post by fmw42 »

One other thought. Perhaps the delegate library device (ghostscript?) is not handling eps conversion to transparency. But once you get a normal png that will convert properly with the -transparent command.
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: Convert EPS with Mac Preview to PNG

Post by glennrp »

Sorry, I don't notice PMs. Now I see that there is a tiny notification
  • User Control Panel (0 new messages
so I'll try to remember
to watch for that in fhe future.
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: Convert EPS with Mac Preview to PNG

Post by glennrp »

What's happening is that the EPS image is in the CMYK colorspace.
Therefore the "-transparent white" directive doesn't work.

As you noted, converting to PNG first and then applying "transparent white"
works. That's because the PNG is written in the RGB colorspace.

These also work:

Code: Select all

convert SampleLogo_1bit.EPS -colorspace RGB -transparent white \
           PNG32:png32.png

convert SampleLogo_1bit.EPS -colorspace RGB -transparent white \
           PNG8:png8.png
If there is a bug, it's not in the PNG encoder but in the handling
of "-transparent white" with CMYK images.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Convert EPS with Mac Preview to PNG

Post by fmw42 »

Glenn,

For vector input images (is not eps vector?), should not the -colorspace RGB be a read modifier and so go before the image.

convert -colorspace RGB image.eps -transparent white PNG32:result.png

etc for PNG8

It seems to work fine for me that way.

Fred

P.S. Using profiles to convert from cmyk to rgb might be more accurate.
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: Convert EPS with Mac Preview to PNG

Post by glennrp »

fmw42 wrote:Glenn,
For vector input images (is not eps vector?), should not the -colorspace RGB be a read modifier and so go before the image.
Dunno. I haven't got a clue about how read modifiers work with delegates. If it works for you then I guess putting it before is OK.

Glenn
Post Reply