Due to the alpha value being inserted with _BEFORE, we were ending up
with ARGB instead of RGBA, thus displaying completely wrong colours.
According to libpng's manual, "to add an opaque alpha channel, use filler=0xff
or 0xffff and PNG_FILLER_AFTER which will generate RGBA pixels".
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4759>
/* Add alpha channel if 16-bit depth, but not for GRAY images */
if ((bpc > 8) && (color_type != PNG_COLOR_TYPE_GRAY)) {
- png_set_add_alpha (pngdec->png, 0xffff, PNG_FILLER_BEFORE);
+ png_set_add_alpha (pngdec->png, 0xffff, PNG_FILLER_AFTER);
png_set_swap (pngdec->png);
}
#if 0