libpng warning: Ignoring bad adaptive filter type

2020-07-18 04:17发布

问题:

my app was killed,and the log :libpng warning: Ignoring bad adaptive filter type. I want to know the reason,and the solution.

回答1:

The question gives insufficient information to provide a complete answer.

The "bad adaptive filter type" message means that the PNG file is either corrupted or was generated by a buggy encoder.

Each scanline of a PNG file begins with a "filter type" byte which must be 0, 1, 2, 3, or 4.



回答2:

I had this issue before, the image was corrupted by unknown reason, the solution of catching such an error can be using the code below (in Python):

try:
    Image.open(path).tobytes()
except IOError:
    print('detect error img %s' % path)
    continue