Page 1 of 1

Transparency lost in PDF to PNG

Posted: 2009-04-13T15:56:44-07:00
by sdalu
I'm reading a PDF file (adobe illustrator) and trying to save it as png

$img->read('logo.ai');
$img->write('logo.png');

The probleme is that I'm loosing all the transparency and semi-transparency

using instead:
$img->read('logo.ai');
$img->Transparent('color' => 'white');
$img->write('logo.png');

doesn't resolve the problem for the semi-transparency.

What are the correct PerlMagick (ver: 6.5.1.1) settings to use?

Sincerly

Re: Transparency lost in PDF to PNG

Posted: 2009-04-13T16:21:34-07:00
by magick
Post a URL to logo.ai so we can reproduce the problem and suggest a solution.

Re: Transparency lost in PDF to PNG

Posted: 2009-04-13T16:43:07-07:00
by sdalu
PDF file: http://dl.free.fr/jr8MhtYWh
Expected PNG result: http://dl.free.fr/j0zgE6wSg

Rectangles present in files are:
* Top Left: gray with transparency
* Top right: gray
* Bottom Left: transparent
* Bottom Right: white

Re: Transparency lost in PDF to PNG

Posted: 2009-04-13T18:34:16-07:00
by magick
Try
  • $img->Read('ai:logo.ai');
    $img->write('logo.png');
We get a transparent background but the rectangles are not transparent. This is a limitation of the Ghostscript pngalpha device since ImageMagick uses this device to render PDF.

Re: Transparency lost in PDF to PNG

Posted: 2009-04-14T01:56:41-07:00
by sdalu
Effectiveley, prefixing with ai: I've got some extra-transparency, but not for the whole background, as white is still present between rectangles (http://dl.free.fr/qb4aYerfa), but I guess this is also part of the pngalpha problem.

Thank you