test_02.py:205:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
test_02.py:43: in do_test
self.check_img_file(f1, f2)
testlib.py:66: in check_img_file
img_a = self.__image_load(a)
testlib.py:53: in __image_load
for png_row in png_img:
png.py:1708: in iterstraight
recon = self.undo_filter(filter_type, scanline, recon)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <png.Reader object at 0x000001659DD273C8>, filter_type = 255
scanline = array('B', [0, 0, 255, 0, 0, ...])
previous = array('B', [255, 0, 0, 255, 0, ...])
def undo_filter(self, filter_type, scanline, previous):
"""Undo the filter for a scanline. `scanline` is a sequence of
bytes that does not include the initial filter type byte.
`previous` is decoded previous scanline (for straightlaced
images this is the previous pixel row, but for interlaced
images, it is the previous scanline in the reduced image, which
in general is not the previous pixel row in the final image).
When there is no previous scanline (the first row of a
straightlaced image, or the first row in one of the passes in an
interlaced image), then this argument should be ``None``.
The scanline will have the effects of filtering removed, and the
result will be returned as a fresh sequence of bytes.
"""
# :todo: Would it be better to update scanline in place?
# Yes, with the Cython extension making the undo_filter fast,
# updating scanline inplace makes the code 3 times faster
# (reading 50 images of 800x800 went from 40s to 16s)
result = scanline
if filter_type == 0:
return result
if filter_type not in (1,2,3,4):
> raise FormatError('Invalid PNG Filter Type.'
' See
http://www.w3.org/TR/2003/REC-PNG-20031110/#9Filters .')
E png.FormatError: FormatError: Invalid PNG Filter Type. See
http://www.w3.org/TR/2003/REC-PNG-20031110/#9Filters .
png.py:1498: FormatError