Re: Why is it that png files are not dependable over the long haul
Cosmin Truta <[email protected]> Tue, 7 Aug 2018 01:31:51 -0400
| Newsgroups | gmane.comp.graphics.png.devel |
|---|---|
| Message-ID | <CAAoVtZz2KhR=ncwYgbTD-kfoMCGt-s4+UrBAOVST9=BX4gSUNg@mail.gmail.com> |
Greg Roelofs wrote:
> 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.)
Indeed. (Just checked.) That tool is called png-fix-IDAT-windowsize.
It may or may not be packaged by your OS distribution, and, if that's
not the case, I hope you can build it from source.
Alternatively, I also noticed that pngfix (found in
libpng/contrib/tools/pngfix.c) can fix a bunch of issues, including
this one.
There is a tiny difference between pngfix and png-fix-IDAT-windowsize:
the 1st one leaves the zlib compression method at its original value;
the 2nd one sets it to "default". There is absolutely no difference in
the output image: both tools produce slightly different deflate
streams inside IDAT, but with identical output images.
Here is how to use these tools. For pngfix:
pngfix -o --out=output.png input.png
# produces "output.png"
And for png-fix-IDAT-windowsize:
png-fix-IDAT-windowsize input.png
# produces "input-fixed.png"
I hope you will be able to fix your images, Ruben.
Sincerely,
Cosmin
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot