Transparency lost in PDF to PNG

PerlMagick is an object-oriented Perl interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning PerlMagick.
Post Reply
sdalu

Transparency lost in PDF to PNG

Post 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
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Transparency lost in PDF to PNG

Post by magick »

Post a URL to logo.ai so we can reproduce the problem and suggest a solution.
sdalu

Re: Transparency lost in PDF to PNG

Post 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
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Transparency lost in PDF to PNG

Post 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.
sdalu

Re: Transparency lost in PDF to PNG

Post 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
Post Reply