Re: Simple API and associated alpha
Glenn Randers-Pehrson <[email protected]>
| Newsgroups | gmane.comp.graphics.png.devel |
|---|---|
| Message-ID | <CA+PdXcsMqCziD=a8_Dv7M=BUC=a7kXZ7zCNZTuAy141a_vmyAg@mail.gmail.com> |
Your input image has regular non-associated alphas. The simplified API isn't going to premultiply them for you. It "expects" them to be premultiplied/associated. So I don't think it's a bug; you just gave it unexpected input and it dealt with it in a way that you did not expect. On Tue, Sep 5, 2017 at 8:39 PM, Samuel Williams <[email protected]> wrote: > I'm using the simple API to read an 8-bit RGBA PNG. > > Here is the image: > https://github.com/kurocha/images/blob/master/test/Images/fixtures/bacon.png > > I'm writing some tests to check the behaviour in comparison to WebP. > > Here is the documentation I'm reading: > > When an alpha channel is present it is expected to denote pixel coverage > of the color or luminance channels and is returned as an associated alpha > channel: the color/gray channels are scaled (pre-multiplied) by the alpha > value. > > I've written a test to load this image, and where the alpha channel is > 0, I also expect color channel to be zero. > > Here is the code that uses the simple API to read the pixel data: > https://github.com/kurocha/images/blob/2cb3397cd5ed6966cf1fd852dca855909b80c15e/source/Images/PNGImage.cpp#L43-L50 > > Here is the test: > > https://github.com/kurocha/images/blob/2cb3397cd5ed6966cf1fd852dca855909b80c15e/test/Images/Test.Transparency.cpp#L30-L38 > > However, in many cases this is not true. Is this a bug? Am I > misinterpreting the documentation? > > Thanks > Samuel > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > _______________________________________________ > png-mng-implement mailing list > png-mng-implement-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org > https://lists.sourceforge.net/lists/listinfo/png-mng-implement ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot