Re: Some new Alpha-related capabilities

Phil M Perry <philperry-N4erKOH/[email protected]> Wed, 10 Oct 2018 22:11:29 -0400
Newsgroups gmane.comp.graphics.png.devel
Message-ID <[email protected]>
(First reply to this list... I hope it gets to the right thread)

Hi Cosmin,

Point 1, I found a fast FlateDecode Perl library that does an adequate 
job of compressing the data streams (image and any Alpha channel) in a 
flavor that PDF likes. So, I don't think there's any further work needed 
on this item.

Point 2, this is probably the slowest part of handling the PNG data, so 
a speedup would be welcome. I can do it in pure Perl, which is quite 
slow. I haven't found any existing libraries for Perl (typically written 
in C) that will do this, and I'm trying to avoid a) writing my own new 
library package just for this, and b) prereq'ing yet another package. I 
was hoping this function could be incorporated into libpng, as you 
already have functionality to strip out the Alpha channel. Rather than 
discarding the Alpha data on "strip", you would keep it around and make 
it available on a separate call.

Point 3, again, building a full image Alpha mask from a tRNS chunk is 
quite slow in pure Perl, and again, I'd rather not have to build a new 
C-source library package for Perl (presumably it could share the 
Alpha-strip code). It could well be that other image processing could 
also use something that provides a full Alpha mask from tRNS, in libpng. 
It might even use the same "return Alpha mask" call as Point 2, if no 
Alpha was stripped off and tRNS exists. I'm assuming that you'll never 
see an Alpha channel AND a tRNS chunk at the same time

An alternative would be to try to persuade the owner of the thin wrapper 
around libpng (for Perl library) to incorporate this into his code, but 
at this time he seems very reluctant to do any such thing. If you put it 
in libpng, I hope he would add the one or two new calls to his wrapper. 
As a last resort, I could try to add the code to either libpng and 
submit it to you, or to the wrapper (which I think is on GitHub) and 
submit a pull request, but I don't know if I'm going to have time to do 
either (and first I need to figure my way through either project).

thanks much, Phil