Re: Speed problem re rgb+alpha PNG

Hugh Dixon <hugh-g/[email protected]> Thu, 26 Jun 2008 10:16:11 +0100
Newsgroups gmane.comp.lang.perl.modules.pdfapi2
Message-ID <C4891CEB.229D%[email protected]>
If you overlay any images with transparency on each other, I'd be very
interested if you test print the PDF's - I found some very odd effects when
experimenting with this ages ago - I could see a "shadow" of the transparent
area where it overlapped another image but only when printed - on screen the
PDF looked perfect.

Hugh


On 24/06/2008 20:01, "Alfred Reibenschuh" <[email protected]> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
> 
> Henning Michael Møller Just wrote:
> | Hi everyone
> |
> | I'm having some trouble creating an image object with $img =
> $pdf->image_png(...)
> |
> | The object is created and it works, but it takes a very long time. The
> image is 2482x3510 pixels and is RGBA ($cs == 6). The time is spent in
> the PDF::API2::Resource::XObject::Image::PNG::unprocess() function and
> then in the new() method in the lines
> |
> |             foreach my $n (0..($h*$w)-1) {
> |                 vec($dict->{'
> stream'},$n,$bpc)=vec($clearstream,($n*4)+3,$bpc);
> |                 vec($self->{'
> stream'},($n*3),$bpc)=vec($clearstream,($n*4),$bpc);
> |                 vec($self->{'
> stream'},($n*3)+1,$bpc)=vec($clearstream,($n*4)+1,$bpc);
> |                 vec($self->{'
> stream'},($n*3)+2,$bpc)=vec($clearstream,($n*4)+2,$bpc);
> |             }
> |
> | I'm supposing this is getting the alpha mask out from the image and
> then actually removing the transparent parts from the image? Or?
> |
> | On our relatively fast servers, this is taking about 3-4 minutes. It
> turned out in this particular case we didn't need transparency so we
> just saved it without ($cs == 2) and it's almost instantaneous now.
> |
> | But we will probably need transparency later, so I'd like to know if
> there's something I can do. I'd rather not publisice the image (we are
> doing this for a client), but I could send it privately for someone to
> examine closer.
> 
> the question is wherether you need full alpha support or
> can live with simple transparency.
> 
> if you need full alpha, the api has to extract the channel no matter what.
> 
> if you can live with transparency, define a transparent colour
> (via png tRNS chunk) and the api will take the image almost verbatim.
> 
> 
> cheers,
> 
> - --
> fredo
> 
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
> 
> iEYEAREIAAYFAkhhRKcACgkQpyPEZ/g4emPzGACfQljLxQRx/JsG3/TfT5l6j8N5
> pqYAnjEC7BMkcRjdOOCX7HThBn6utVBJ
> =lReH
> -----END PGP SIGNATURE-----
> 
> ------------------------------------
> 
> To unsubscribe from this group, send an email to:
> perl-text-pdf-modules-unsubscribe-Km8ibD4bFueDmjp1MlKEbA@public.gmane.org
> 
> Yahoo! Groups Links
> 
> 
>