Re: Some new Alpha-related capabilities
Phil M Perry <philperry-N4erKOH/[email protected]> Mon, 15 Oct 2018 13:43:18 -0400
| Newsgroups | gmane.comp.graphics.png.devel |
|---|---|
| Message-ID | <[email protected]> |
I see there is a png_set_tRNS_to_alpha() function already in libpng (ref Point 3 above), but it has no interface yet in the Perl Image::PNG::Libpng wrapper. That would have to be supplied by the owner of that wrapper. For my purposes, while converting tRNS transparency to alpha is good, even better would be the ability to return it by itself, so I don't have to (slowly) separate it from the full image GA or RGBA. So long as tRNS is converted to Alpha /before/ Alpha-stripping is done (to be set aside and returned by a new call), that would be adequate. At least, it appears that the bulk of the work for Point 3 has already been done. There /is/ a setting in the Perl wrapper (maps to png_set_expand) to expand palette to RGB, samples to 8 bits, and tRNS to Alpha; but I'm still left with Point 2 (slow separation in Perl of RGB/G and Alpha) even if that is adequate for the purposes of Point 3. I don't think creators of PDFs using my library (PDF::Builder) are going to care all that much that RGB/G samples have been expanded, or palette color is now RGB, so long as the implementation is far faster than what it is today (image sizes will of course expand). With Points 2 and 3, a full Alpha mask returned to me would satisfy my current needs. If libpng has a way to apply Gamma to the returned data (either from gAMA chunk or overridden), that would be useful for future work. It sounds like it does, but it's not clear whether this is enabled in the Perl wrapper (there's no mention of it). Other things, such as white point, etc. remain to be seen. Some PDF creators may wish to be able to fine-tune their images (for printing or for display), but I'll hold off on that for now. Same goes for color->gray (for printing in B&W), but I think that's already in the wrapper. Set/ignore background color, and image size (scaling) in libpng may be other things I'll be wanting to implement.