You are not logged in.
I have a number of older PNG images from various sources I cannot view any more. xv outputs the above error message when I try, and display and gimp output similar error messages. This seems to be an issue with libpng16. I can view the images on older Linux systems (libpng12 and libpng15) and on (shudder) windoze, so the files themselves do not seem to be broken.
Has anyone experienced the same problem and possibly found a solution?
Last edited by deepsoul (2014-01-22 21:10:35)
Officer, I had to drive home - I was way too drunk to teleport!
Offline
OK, so I could have done some more research before posting. Further web search revealed that libpng intentionally broke backward compatibility with their own past broken output. Commandlines with optipng and pngcrush are reported as fixing up the alleged PNG files:
pngcrush -fix -force old.png new.png
optipng -quiet -force -fix foo.png
I only used the optipng command - it is in the community repository, where pngcrush is in AUR, and converts in place.
However, this alone did not really solve my problem. I have hundreds of PNGs, some downloaded (which I do not want to convert), some converted from downloaded GIFs, some created myself, with various libpng versions over the years. So I wrote a small program called brokenpng that tries to decode a PNG file with libpng and returns 0 (= true in shell) only if libpng bails out. You use it as follows to generate a list of broken PNGs:
find . -iname \*.png | while read f ; do /path/to/brokenpng $f &>/dev/null && echo $f ; done > /tmp/badpnglist
After inspecting the list and possibly making backups, you can convert them all using 3 parallel jobs:
cat /tmp/badpnglist | xargs -n 1 -P 3 optipng -quiet -force -fix
Disclaimer: brokenpng was quickly written and will return true on libpng errors other than the above. If you have spaces in your path names, the shell code will not work.
Officer, I had to drive home - I was way too drunk to teleport!
Offline
The "too far back" error report was introduced in libpng-1.6.0 and removed from libpng-1.6.3. So, please upgrade to libpng-1.6.3 or later (current version is 1.6.8).
Offline
The version of libpng I use is 1.6.7:
> ldd `which xv` | grep png
libpng16.so.16 => /usr/lib/libpng16.so.16 (0x00007f51988dc000)
> pacman -Qo /usr/lib/libpng16.so.16
/usr/lib/libpng16.so.16 is owned by libpng 1.6.7-1
This is the latest arch package, though it is flagged out of date. So apparently the error message is still there in the arch version, which I am glad about, because the solution might otherwise have been quite hard to find.
Are you posting on behalf of the libpng project? If so, thank you for the good documentation that allowed me to write the brokenpng program quickly. Plenty of discredits for the self-incompatibility without a large-scale file update method, though.
Officer, I had to drive home - I was way too drunk to teleport!
Offline