Re: Why is it that png files are not dependable over the long haul

Greg Roelofs <[email protected]> Mon, 6 Aug 2018 19:34:09 -0700
Newsgroups gmane.comp.graphics.png.devel
Message-ID <[email protected]>
Cosmin wrote:

> The explanation is as follows:
>
> Long ago (more than 10 years ago, IIRC around the year 2004), there
> was a bug in the libpng encoder that existed for a short period of
> time, that produced zlib streams with an incorrect window size. By
> incorrect, I mean smaller than they should be. They can be larger than
> they should, that's ok; but smaller, that's not ok. Your images have a
> small window size, so they are not ok. The pngcheck program indicates
> an 8KB window, when in fact it should be 32KB.
>
> The recovery consists in making the 32KB window, always, because that
> is the maximum, then decode, and re-encode. That's easy to do. Also
> easy to explain: use a larger array, problem solved.

If that's actually the root of the problem, then the fix is far more
trivial:  simply update the "windowBits" setting in the zlib header,
which is a single byte.  I wrote a utility to do exactly that and
included it in the pngcheck package a decade ago; take a look and give
it a try.  (It's a command-line tool, but as I recall, it accepts wildcard
filenames, so

	<whatever it's called> *.png

should work.)

I'm in Hawaii at the moment and don't have easy access to my tools,
nor have I read the rest of this thread yet, but I wanted to get the
message out before my laptop battery dies...

Greg

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot