PNG file check

I have a Flash web application that displays custom PNG files. Files are uploaded to the server through some API before displaying. I would like to make sure that "bad" files are not loaded for Flash, where "bad" is completely non-specific. Is there a way to check PNG files for compliance with PNG specifications (this will lead to the failure of damaged files)? Or any better rating when working with untrusted image files? I only need to handle PNG, so I need support for JPG, GIF, etc. The language is basically irrelevant, although I would prefer Python solutions. This is located on the Unix web server.

Thanks Simon

+4
source share
1 answer

I would suggest using Python and PIL (Python Imaging Library for this):

from PIL import Image v_image = Image.open(file) v_image.verify() 

Catch any exceptions ...

+7
source

Source: https://habr.com/ru/post/1303539/


All Articles