Handle truncated chunks at the end of PNG images by lajiyuan · Pull Request #7709 · python-pillow/Pillow

Fix png image plugin load_end func handle truncated file.

When attempting to process PNG image files that are incomplete at the end, the current LOAD_TRUNCATED_IMAGES parameter is unable to handle such cases. It is necessary to add corresponding handling code within the load_end function to ensure proper processing of incomplete images. Below is a link to an example of such an anomalous image:

error_image

Changes proposed in this pull request:

  • Fix PngImagePlugin.py load_end func, add exception handle.

cc @radarhere Can you help me with a code review? thanks a lot.