[ prog / sol / mona ]

prog


What are you working on?

123 2020-07-07 10:35

The smallest image of the four >>121 >>122 is the last one, at 512x562 8-bit RGBA(6). Its iDOT chunk is (2, (0, 281, 0x28), (281, 281, 0x4722)). The 281 is half the height and the offsets are to IDAT run leaders. The two IDAT runs are [16384, 1762] and [16245].

PNG IDAT chunks contain the stream of deflated filtered rows.
https://tools.ietf.org/html/rfc2083
For this RGBA(6) image a filtered row is 2049 bytes:

>>> 512 * 4 + 1
2049

A run of 281 filtered rows is 575769 bytes:

>>> _ * 281
575769

The full filtered row stream is 1151538 bytes:

>>> _ * 2
1151538

Here is a decompression of the IDAT stream with a bit of verbosity showing the decompressor input, the decompressor output and a running total of the output:

Vc2eT5I.png -> temp/p.pixels
   512x562 8-bit RGBA(6)
deco in 16384
deco out 65536 -> 65536
deco out 65536 -> 131072
deco out 65536 -> 196608
deco out 65536 -> 262144
deco out 65536 -> 327680
deco out 65536 -> 393216
deco out 65536 -> 458752
deco out 35596 -> 494348
deco in 1762
deco out 65536 -> 559884
deco out 15885 -> 575769
deco in 16245
deco out 65536 -> 641305
deco out 65536 -> 706841
deco out 65536 -> 772377
deco out 65536 -> 837913
deco out 65536 -> 903449
deco out 65536 -> 968985
deco out 65536 -> 1034521
deco out 65536 -> 1100057
deco out 51481 -> 1151538
   filters: [0, 562, 0, 0, 0]

After the first IDAT run is consumed, exactly the 575769 bytes of the first run of 281 filtered rows have been generated. The second IDAT run generates the bytes for the next run of 281 filtered rows. This seems to be the link between the IDAT run division and the iDOT chunk.

199


VIP:

do not edit these