Page 1 of 1

Converting EPS to PNG keeping transparency

Posted: 2011-07-11T09:57:29-07:00
by christoph.schmidt
Hello,

i need to convert an EPS with transparent background into an PNG with transparent background.

A simple:

convert.exe -density 300x300%% EPSzeilenHintergrund.eps EPSzeilenHintergrund.png

doesnt work for me.

I also tried to set: -transparent-color white and so on.... also it didn't work.

Identify of the eps shows the following:

Code: Select all

Image: 7921633.eps
  Format: EPT (Encapsulated PostScript with TIFF preview)
  Class: DirectClass
  Geometry: 145x52+0+0
  Resolution: 72x72
  Print size: 2.01389x0.722222
  Units: Undefined
  Type: ColorSeparation
  Base type: ColorSeparation
  Endianess: Undefined
  Colorspace: CMYK
  Depth: 16/8-bit
  Channel depth:
    cyan: 1-bit
    magenta: 1-bit
    yellow: 1-bit
    black: 8-bit
  Channel statistics:
    Cyan:
      min: 0 (0)
      max: 0 (0)
      mean: 0 (0)
      standard deviation: 0 (0)
      kurtosis: 0
      skewness: 0
    Magenta:
      min: 0 (0)
      max: 0 (0)
      mean: 0 (0)
      standard deviation: 0 (0)
      kurtosis: 0
      skewness: 0
    Yellow:
      min: 0 (0)
      max: 0 (0)
      mean: 0 (0)
      standard deviation: 0 (0)
      kurtosis: 0
      skewness: 0
    Black:
      min: 0 (0)
      max: 65535 (1)
      mean: 13515.4 (0.206232)
      standard deviation: 20539.4 (0.31341)
      kurtosis: -0.147122
      skewness: 1.17547
  Image statistics:
    Overall:
      min: 0 (0)
      max: 65535 (1)
      mean: 3378.86 (0.0515581)
      standard deviation: 10269.7 (0.156705)
      kurtosis: 23.7849
      skewness: 5.52574
  Total ink density: 100%
  Histogram:
      4826: (    0,    0,    0,    0) #0000000000000000 black
       673: (    0,    0,    0,48059) #000000000000BBBB black
       489: (    0,    0,    0,17476) #0000000000004444 black
       437: (    0,    0,    0,34952) #0000000000008888 black
       177: (    0,    0,    0,65535) #000000000000FFFF black
       124: (    0,    0,    0,56797) #000000000000DDDD black
       117: (    0,    0,    0,26214) #0000000000006666 black
        94: (    0,    0,    0,61166) #000000000000EEEE black
        76: (    0,    0,    0,39321) #0000000000009999 black
        67: (    0,    0,    0,13107) #0000000000003333 black
        65: (    0,    0,    0,21845) #0000000000005555 black
        64: (    0,    0,    0,52428) #000000000000CCCC black
        59: (    0,    0,    0,43690) #000000000000AAAA black
        59: (    0,    0,    0, 4369) #0000000000001111 black
        57: (    0,    0,    0,30583) #0000000000007777 black
        57: (    0,    0,    0, 8738) #0000000000002222 black
        28: (    0,    0,    0,52685) #000000000000CDCD black
         7: (    0,    0,    0,57311) #000000000000DFDF black
         7: (    0,    0,    0,42919) #000000000000A7A7 black
         7: (    0,    0,    0,50372) #000000000000C4C4 black
         6: (    0,    0,    0,51400) #000000000000C8C8 black
         4: (    0,    0,    0,51143) #000000000000C7C7 black
         4: (    0,    0,    0,20560) #0000000000005050 black
         4: (    0,    0,    0,44975) #000000000000AFAF black
         4: (    0,    0,    0,36494) #0000000000008E8E black
         3: (    0,    0,    0,49087) #000000000000BFBF black
         3: (    0,    0,    0,33410) #0000000000008282 black
         2: (    0,    0,    0,46260) #000000000000B4B4 black
         2: (    0,    0,    0,30069) #0000000000007575 black
         2: (    0,    0,    0,38807) #0000000000009797 black
         2: (    0,    0,    0,55255) #000000000000D7D7 black
         2: (    0,    0,    0,40863) #0000000000009F9F black
         1: (    0,    0,    0,42148) #000000000000A4A4 black
         1: (    0,    0,    0, 8224) #0000000000002020 black
         1: (    0,    0,    0,49601) #000000000000C1C1 black
         1: (    0,    0,    0,26985) #0000000000006969 black
         1: (    0,    0,    0,16448) #0000000000004040 black
         1: (    0,    0,    0,27499) #0000000000006B6B black
         1: (    0,    0,    0,36751) #0000000000008F8F black
         1: (    0,    0,    0,49344) #000000000000C0C0 black
         1: (    0,    0,    0,41891) #000000000000A3A3 black
         1: (    0,    0,    0,33924) #0000000000008484 black
         1: (    0,    0,    0,58082) #000000000000E2E2 black
         1: (    0,    0,    0,53713) #000000000000D1D1 black
  Rendering intent: Undefined
  Interlace: None
  Background color: white
  Border color: cmyk(223,223,223,0)
  Matte color: grey74
  Transparent color: black
  Compose: Over
  Page geometry: 145x52+0+0
  Dispose: Undefined
  Iterations: 0
  Compression: Undefined
  Orientation: Undefined
  Properties:
    date:create: 2011-07-11T18:56:56+02:00
    date:modify: 2011-07-11T18:56:56+02:00
    ps:HiResBoundingBox: 145x52+0+0
    ps:Level: Adobe-3.0 EPSF-3.0

    ps:SpotColor-0: 1.01 1.01 1.01 1 sw
    ps:SpotColor-1: sw
    signature: ccb4c4e5f64af75592808244522084c6e52e8cd829191c3484ac77cce1bf7e9b
  Artifacts:
    verbose: true
  Tainted: False
  Filesize: 30.3KBB
  Number pixels: 7.54KB
  Pixels per second: 75.4TB
  User time: 0.000u
  Elapsed time: 0:01.000
  Version: ImageMagick 6.6.7-10 2011-02-22 Q16 http://www.imagemagick.org
Does anyone have an idea how to do this? :-)

Re: Converting EPS to PNG keeping transparency

Posted: 2011-07-11T10:44:34-07:00
by fmw42
According to your listing, your eps is in CMYK and does not show any transparency. PNG does not support CMYK, if I am not mistaken, so you would have to convert that to rgb

convert -colorspace RGB yourimage.eps ... PNG32:yourimage.png

However, I am not sure what to do, since IM does not see any transparency, it cannot copy it to the output.

If this is from Photoshop, it supports both background transparency and alpha channel transparency. There really is no background transparency until PS reads some flag to know it is there so it can display it that way. Many other applications including IM cannot handle background transparency, only alpha channel transparency. So I suspect you may be out of luck with IM. You can try GIMP or some other tool.

If some one knows that I am in error about any of this, please correct me. I will defer to your expertise.

P.S. This Photoshop file issue of two kinds of transparencies is something that I hope gets addressed eventually in IM 7.

Re: Converting EPS to PNG keeping transparency

Posted: 2011-07-11T13:12:01-07:00
by glennrp
This is near the beginning of the png encoder:

Code: Select all

 if (IsRGBColorspace(image->colorspace) == MagickFalse)
    (void) TransformImageColorspace(image,RGBColorspace);
So it does sort of support CMYK, by transforming any CMYK
image to RGB.

There were problems with the PNG encoder's handling of transparency
until recently, so you might want to upgrade from 6.6.7 to 6.7.0 or later.

Glenn

Re: Converting EPS to PNG keeping transparency

Posted: 2011-07-13T08:24:30-07:00
by christoph.schmidt
Thank you...

convert -colorspace RGB yourimage.eps ... PNG32:yourimage.png

Did it.. .even with 6.6.7-10