Skip to content

pngdec: Fix wrong colours output from 16bit RGB images

Fixes #2618 (closed)

For 16bit RGB (no alpha) files pngdec inserts an opaque alpha channel so we can later output ARGB64. It was, however, being inserted incorrectly - per the libpng manual:

To add an opaque alpha channel, use filler=0xff or 0xffff and PNG_FILLER_AFTER which will generate RGBA pixels.

Meanwhile we're using PNG_FILLER_BEFORE. 16bit RGBA files were working fine, so this was the only part that could possibly cause issues. After changing that output looks correct - here's a quick comparison:

before after
image image

Merge request reports