Re: What is png_get_palette_max supposed to do?

Ben Bullock <[email protected]> Mon, 14 Dec 2020 16:47:46 +0900
Newsgroups gmane.comp.graphics.png.devel
Message-ID <CAN5Y6m_Mq5zusmV8nV+admYuN=sm7D1OUwL_+2dDKwtX__PiFw@mail.gmail.com>
Running this script:

https://github.com/benkasminbullock/image-png-libpng/blob/master/util/get-palette-max.pl

on PngSuite, which prints get_palette_max and the size of the palette for
each file with a valid PLTE chunk, I get the following results:

basi3p01.png 0 2
basi3p02.png 0 4
basi3p04.png 14 15
basi3p08.png 0 256

One file has get_palette_max of 14 and the others are 0.

basn3p01.png 0 2
basn3p02.png 0 4
basn3p04.png 0 15
basn3p08.png 0 256
ccwn3p08.png 0 246
ch1n3p04.png 0 15
ch2n3p08.png 0 256
cs3n3p08.png 0 28
cs5n3p08.png 0 32
cs8n3p08.png 0 32
g03n3p04.png 0 10
g04n3p04.png 0 10
g05n3p04.png 0 10
g07n3p04.png 0 10
g10n3p04.png 0 10
g25n3p04.png 0 10
pp0n2c16.png 0 216
pp0n6a08.png 0 216
s01i3p01.png 0 1
s01n3p01.png 0 1
s02i3p01.png 0 1
s02n3p01.png 0 1
s03i3p01.png 0 2
s03n3p01.png 0 2
s04i3p01.png 0 2
s04n3p01.png 0 2

In the following the interlaced files get a value of 2:

s05i3p02.png 2 3
s05n3p02.png 0 3
s06i3p02.png 2 3
s06n3p02.png 0 3

Back to 0:

s07i3p02.png 0 4
s07n3p02.png 0 4
s08i3p02.png 0 4
s08n3p02.png 0 4
s09i3p02.png 0 4
s09n3p02.png 0 4

Again the interlaced files have 12 versus 0 for the non-interlaced files:

s32i3p04.png 12 13
s32n3p04.png 0 13
s33i3p04.png 12 13
s33n3p04.png 0 13
s34i3p04.png 12 13
s34n3p04.png 0 13
s35i3p04.png 12 13
s35n3p04.png 0 13
s36i3p04.png 12 13
s36n3p04.png 0 13
s37i3p04.png 12 13
s37n3p04.png 0 13
s38i3p04.png 12 13
s38n3p04.png 0 13
s39i3p04.png 12 13
s39n3p04.png 0 13
s40i3p04.png 12 13

Back to zero:

s40n3p04.png 0 13
tbbn3p08.png 0 246
tbgn3p08.png 0 246
tbwn3p08.png 0 245
tbyn3p08.png 0 246
tm3n3p02.png 0 4
tp0n3p08.png 0 245
tp1n3p08.png 0 245

While I'm sure the most likely explanation for this is some kind of
programming error on my part, does anybody have any insight at all into why
I would get these values? If I add writing of the PNG to it I then get
different values as well for the writing PNG structure for some cases. I've
posted the output here:

https://gist.github.com/benkasminbullock/a4bd5e689c5a65de31fc728655a4957b

I've also made a C version of the above, and I'm getting very similar
results:

https://github.com/benkasminbullock/image-png-libpng/blob/master/util/gpm/gpm.c

I've posted the output here since it is long:

https://gist.github.com/benkasminbullock/6983ad49daa5f639dded167d3907be70

_______________________________________________
png-mng-implement mailing list
png-mng-implement-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/png-mng-implement