typedef enum WEBP_CSP_MODE {MODE_RGB = 0, MODE_RGBA = 1,MODE_BGR = 2, MODE_BGRA = 3,MODE_ARGB = 4, MODE_RGBA_4444 = 5,MODE_RGB_565 = 6,// RGB-premultiplied transparent modes (alpha value is preserved)MODE_rgbA = 7,MODE_bgrA = 8,MODE_Argb = 9,MODE_rgbA_4444 = 10,// YUV modes must come after RGB ones.MODE_YUV = 11, MODE_YUVA = 12, // yuv 4:2:0MODE_LAST = 13} WEBP_CSP_MODE;
Is there any way to specify that the source IS pre-multiplied so we can save data directly from frame-buffer?
Strangely enough, I generated a pixel buffer containing RGBA8{128, 128, 128, 128} and saved it as both PNG and WebP using the default settings.I then used ImageMagick to composite these files by dropping the alpha channel, and the result was identical. Is that odd? They also both look the same in Chrome.Given that libpng states it's interpreting the PNG data as associated,
and you've stated that WebP interprets the data as unassociated, I would have imagined the WebP composite would have been darker.The above are decode only, for encoding we assume the source is non-premultiplied. Have a look at tiffdec.c [1].
Correct me if I'm wrong, but assuming the documentation on libpng
simple API is correct:
PNG associated input RGBA8{128, 128, 128, 128} input is stored as
RGBA8{255, 255, 255, 128} unassociated in file format.
WebP (unassociated?) input RGBA8{128, 128, 128, 128} input is stored
as RGBA8{128, 128, 128, 128} unassociated in file format.
When ImageMagick loads these values and blends them, the output should
be different?
On 31 July 2017 at 01:42, Samuel Williams
>> email to webp-discuss+unsubscribe@webmproject.org.