RE: Speed problem re rgb+alpha PNG
Henning Michael Møller Just <HenningMichael.MollerJust-B5obmGyaMydknbxzx/[email protected]> Thu, 26 Jun 2008 11:24:52 +0200
| Newsgroups | gmane.comp.lang.perl.modules.pdfapi2 |
|---|---|
| Message-ID | <[email protected]> |
Interesting. No, we haven't experienced that, but then again, our experience with actual transparency (and not the current issue) was also a very long time ago. I think we used a PNM image to add the transparency as a mask back then, that could explain the difference. And thanks to Alfred for his reply. For some reason I hadn't received it but the information was very helpful. In reality it means we have to instruct our clients on how to use transparency =:-| /Henning ________________________________ From: [email protected] [mailto:[email protected]] On Behalf Of Hugh Dixon Sent: Thursday, June 26, 2008 11:16 AM To: [email protected] Subject: Re: [perl-text-pdf-modules] Speed problem re rgb+alpha PNG 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] <mailto:alfredreibenschuh%40gmx.net> > 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 <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 <mailto:perl-text-pdf-modules-unsubscribe%40groups.yahoo.com> > > Yahoo! Groups Links > > > . <http://geo.yahoo.com/serv?s=97359714/grpId=2017382/grpspId=1705007709/msgId=3576/stime=1214471778/nc1=3848643/nc2=4990219/nc3=5370602>