Commit 0cc367aaeaac3f888f255cee5d394968996f736e

John Bowler 2025-01-03T10:35:19

[libpng16] fix: Write order of colourspace chunks should conform to PNG v3 cICP was written after PLTE, not before. The other chunks were output in an order which does not match the new PNG-v3 "priority" order. This change outputs all chunks in the "priority" order; highest precedence first. This means that the PNGs so written conform to PNG v3 (cICP), and allow a streaming app to handle chunks in order, without buffering data which may later be overridden. Note that PNG-v3 establishes the idea of dropping ancillary chunks which are inconveniently ordered in the definition of how APNG chunks are handled. This is a cherry-pick of commit 945f2602a0ea05a7938b2f52df9ef16cf3440291 from branch 'libpng18'. Reviewed-by: Cosmin Truta <ctruta@gmail.com> Signed-off-by: John Bowler <jbowler@acm.org> Signed-off-by: Cosmin Truta <ctruta@gmail.com>