Converting EPS to trnasparent 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?".
Post Reply
mkweb87
Posts: 3
Joined: 2011-09-13T06:25:44-07:00
Authentication code: 8675308

Converting EPS to trnasparent PNG

Post by mkweb87 »

Hey!

I got problem converting from EPS to PNG.

I am Using ImageMagick 6.3.2 (installed on Debian webserver) and want to convert a EPS to PNG with transparent background. I use "convert test.eps test.png".

The PNG has white background!

If I convert .AI file to .EPS and to PNG afterwards, everything works fine, but converting a EPS to PNG doesn't work out with trnaparent background.


Can you help me out?


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

Re: Converting EPS to trnasparent PNG

Post by fmw42 »

Are you sure your eps file has transparency? can you post your file?

try

convert test.eps PNG32:test.png
mkweb87
Posts: 3
Joined: 2011-09-13T06:25:44-07:00
Authentication code: 8675308

Re: Converting EPS to trnasparent PNG

Post by mkweb87 »

that's exactly the problem. I have the file that i converted frpm .AI ti .EPS with imagemagick (right.eps).
this one has transparency when using "convert name.eps name.png"

the file wrong.eps wa ssaved by me from illustrator as .EPS (TIFF, Transparency box checked).

when I open this file in Photohsop it has transparency but converting doesnt work.

Here are the files

dev.newcomerscout.com/right.eps
dev.newcomerscout.com/wrong.eps
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Converting EPS to trnasparent PNG

Post by fmw42 »

I cannot download the wrong.eps file without displaying in my browser ( and it shows only gray) and the saving. After doing that Photoshop will not open the file as it thinks something is wrong. Can you put the full path to your files starting with http://..... so that I can download directly without opening in my browser. The other file (right.eps) displays fine in my browser.

So I suspect your wrong.eps file is not created correctly.

My suspicion is that your tiff transparency has made it with background transparency and not an alpha channel and IM does not handle background transparency well if at all, only alpha transparency.
mkweb87
Posts: 3
Joined: 2011-09-13T06:25:44-07:00
Authentication code: 8675308

Re: Converting EPS to trnasparent PNG

Post by mkweb87 »

dev.newcomerscout.com/eps_files.rar

so how can I solute customers uploading this kind of eps files?

I need preview PNg with transparency?

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

Re: Converting EPS to trnasparent PNG

Post by fmw42 »

As I suspected, your image has background transparency and not alpha transparency. But IM will not handle this format as it does not see any alpha channel to get the transparency to convert to png. Furthermore it is CMYK and not RGB and PNG only supports RGB so one would also have to convert from CMYK to RGB (which one can do, but your transparency is not available)

Code: Select all

identify -verbose wrong.eps

Image: wrong.eps
  Format: EPT (Encapsulated PostScript with TIFF preview)
  Class: DirectClass
  Geometry: 69x22+0+0
  Resolution: 72x72
  Print size: 0.958333x0.305556
  Units: Undefined
  Type: ColorSeparation
  Base type: ColorSeparation
  Endianess: Undefined
  Colorspace: CMYK
  Depth: 16/8-bit
  Channel depth:
    cyan: 8-bit
    magenta: 8-bit
    yellow: 8-bit
    black: 8-bit
  Channel statistics:
    Cyan:
      min: 0 (0)
      max: 57311 (0.87451)
      mean: 14924.3 (0.22773)
      standard deviation: 22320.1 (0.340582)
      kurtosis: -0.622779
      skewness: 1.05922
    Magenta:
      min: 0 (0)
      max: 51400 (0.784314)
      mean: 13388.4 (0.204294)
      standard deviation: 20013.5 (0.305387)
      kurtosis: -0.624384
      skewness: 1.05833
    Yellow:
      min: 0 (0)
      max: 42148 (0.643137)
      mean: 10971.9 (0.167421)
      standard deviation: 16420 (0.250553)
      kurtosis: -0.623439
      skewness: 1.05968
    Black:
      min: 0 (0)
      max: 60652 (0.92549)
      mean: 15796.5 (0.24104)
      standard deviation: 23623.9 (0.360477)
      kurtosis: -0.624172
      skewness: 1.05894
  Image statistics:
    Overall:
      min: 0 (0)
      max: 60652 (0.92549)
      mean: 13770.3 (0.210121)
      standard deviation: 20775.2 (0.317009)
      kurtosis: -0.293471
      skewness: 1.1514

Your right.eps is in RGBA format and so IM can handle it as it has an alpha channel.

Code: Select all

identify -verbose right.eps

Image: right.eps
  Format: PS (PostScript)
  Class: DirectClass
  Geometry: 367x148+0+0
  Resolution: 72x72
  Print size: 5.09722x2.05556
  Units: Undefined
  Type: PaletteMatte
  Endianess: Undefined
  Colorspace: RGB
  Depth: 16/8-bit
  Channel depth:
    red: 8-bit
    green: 8-bit
    blue: 8-bit
    alpha: 8-bit
  Channel statistics:
    Red:
      min: 6682 (0.101961)
      max: 65535 (1)
      mean: 54356.9 (0.829433)
      standard deviation: 20243.7 (0.308898)
      kurtosis: 1.17777
      skewness: -1.66453
    Green:
      min: 6682 (0.101961)
      max: 65535 (1)
      mean: 54381.2 (0.829803)
      standard deviation: 17632.9 (0.269062)
      kurtosis: -0.415728
      skewness: -1.1105
    Blue:
      min: 6168 (0.0941176)
      max: 65535 (1)
      mean: 53356.8 (0.814173)
      standard deviation: 19779.9 (0.301822)
      kurtosis: -0.0933768
      skewness: -1.23877
    Alpha:
      min: 0 (0)
      max: 65535 (1)
      mean: 21409.9 (0.326695)
      standard deviation: 30054 (0.458595)
      kurtosis: -1.41154
      skewness: -0.739054
  Image statistics:
    Overall:
      min: 0 (0)
      max: 65535 (1)
      mean: 51555 (0.786679)
      standard deviation: 22445.6 (0.342497)
      kurtosis: 0.289814
      skewness: -1.36722
  Alpha: rgba(255,255,255,0)   #FFFFFFFFFFFF0000



P.S. Oddly this does work and I don't know why. Perhaps IM is picking it up from the meta data.

convert -colorspace RGB -density 300 wrong.eps wrong.png

However, you lose your white background as you have black letters on transparent background.

To get the image to look the same, you need to flatten it against a white background, but then you lose the transparency

convert -colorspace RGB -density 300 wrong.eps -background white -flatten wrong2.png

So if all you want is a PNG preview, this last command should work at least for this image.
Post Reply