Re: Unofficial pngcheck with cICP support

Ohhhh nice!
Thank you for doing that

On Wed, Jan 8, 2025 at 3:17 PM Chris Lilley <chris@w3.org> wrote:

> I forked a copy of the latest (3.0.3) pngcheck onto GitHub [1]. I then
> hacked in some cICP support [2].
>
> (pngcheck itself is old and crufty, with an if ... else if chain that is
> like 10 pages long. My additions proudly maintain that same lack of
> software engineering).
>
> It checks:
>
>    1. For non-zero matrix values
>    2. For Full range flag values other than 0 or 1
>    3. For the big block of reserved primaries
>    4. For the big block of reserved transfer functions
>    5. For cICP that is not 4 bytes long
>
> It then does pairwise checks (if primaries is this and transfer is that
> then it must be foo) for:
>
>     1. sRGB, sRGB-linear and BT.709
>     2. BT.2020, BT.2021-HLG and BT.2021-PQ
>     3. DCI-P3 and Display P3
>
> It does not currently check in detail for the historical ones, it just
> gives a generic unsupported message. I guess I will add those later. This
> is not any official release just a quick fork-and-hack because I found the
> lack of cICP support so irritating.
>
> Sample non-verbose output:
>
> chris@SuperNomad:/mnt/c/Users/chris/Documents/PNG/CICP$ pngcheck -c test_pattern-HLG.png
>
> test_pattern-HLG.png cICP   Rec. ITU-R BT.2100-2 hybrid log-gamma (HLG) system
> OK: test_pattern-HLG.png (1024x1024, 48-bit RGB, non-interlaced, 99.8%).
>
> Sample verbose outputs:
>
> chris@SuperNomad:/mnt/c/Users/chris/Documents/PNG/CICP$ pngcheck -c -v cICP-and-iCCP.png
> File: cICP-and-iCCP.png (2745 bytes)
>   chunk IHDR at offset 0x0000c, length 13
>     128 x 64 image, 32-bit RGB+alpha, non-interlaced
>   chunk iCCP at offset 0x00025, length 2509
>     profile name = ICC profile, compression method = 0 (deflate)
>     compressed profile = 2496 bytes
>   chunk cICP at offset 0x009fe, length 4
> :   Display P3
>     White x = 0.3127 y = 0.329,  Red x = 0.68 y = 0.32
>     Green x = 0.265 y = 0.69,  Blue x = 0.15 y = 0.06
>     Full range
>   chunk IDAT at offset 0x00a0e, length 151
>     zlib: deflated, 32K window, default compression
>   chunk IEND at offset 0x00ab1, length 0
> No errors detected in cICP-and-iCCP.png (5 chunks, 91.6% compression).
> chris@SuperNomad:/mnt/c/Users/chris/Documents/PNG/CICP$ pngcheck -c -v test_pattern-HLG.png
> File: test_pattern-HLG.png (12698 bytes)
>   chunk IHDR at offset 0x0000c, length 13
>     1024 x 1024 image, 48-bit RGB, non-interlaced
>   chunk iCCP at offset 0x00025, length 2866
>     profile name = 1, compression method = 0 (deflate)
>     compressed profile = 2863 bytes
>   chunk cHRM at offset 0x00b63, length 32
>     White x = 0.3127 y = 0.329,  Red x = 0.708 y = 0.292
>     Green x = 0.17 y = 0.797,  Blue x = 0.131 y = 0.046
>   chunk cICP at offset 0x00b8f, length 4
> :   Rec. ITU-R BT.2100-2 hybrid log-gamma (HLG) system
>     White x = 0.3127 y = 0.329,  Red x = 0.708 y = 0.292
>     Green x = 0.17 y = 0.797,  Blue x = 0.131 y = 0.046
>     Full range
>   chunk IDAT at offset 0x00b9f, length 8192
>     zlib: deflated, 32K window, default compression
>   chunk IDAT at offset 0x02bab, length 1499
>   chunk IEND at offset 0x03192, length 0
> No errors detected in test_pattern-HLG.png (7 chunks, 99.8% compression).
> chris@SuperNomad:/mnt/c/Users/chris/Documents/PNG/CICP$ pngcheck -c -v test_pattern-PQ.png
> File: test_pattern-PQ.png (12033 bytes)
>   chunk IHDR at offset 0x0000c, length 13
>     1024 x 1024 image, 48-bit RGB, non-interlaced
>   chunk iCCP at offset 0x00025, length 2181
>     profile name = 1, compression method = 0 (deflate)
>     compressed profile = 2178 bytes
>   chunk cHRM at offset 0x008b6, length 32
>     White x = 0.3127 y = 0.329,  Red x = 0.708 y = 0.292
>     Green x = 0.17 y = 0.797,  Blue x = 0.131 y = 0.046
>   chunk cICP at offset 0x008e2, length 4
> :   Rec. ITU-R BT.2100-2 perceptual quantization (PQ) system
>     White x = 0.3127 y = 0.329,  Red x = 0.708 y = 0.292
>     Green x = 0.17 y = 0.797,  Blue x = 0.131 y = 0.046
>     Full range
>   chunk cLLi at offset 0x008f2, length 8
>     Old version of CLLI, do not use
> ERRORS DETECTED in test_pattern-PQ.png
>
>
> I built this on Ubuntu Linux running on WSL2 under Windows 11, ie what I
> have. Utterly untested on any other system.
>
> [1] https://github.com/svgeesus/pngcheck
> [2] https://github.com/svgeesus/pngcheck/pull/1
>
> --
> Chris Lilley
> @svgeesus
> Technical Director @ W3C
> W3C Strategy Team, Core Web Design
> W3C Architecture & Technology Team, Core Web & Media
>
>

Received on Thursday, 9 January 2025 12:47:39 UTC