Newer
Older
def is_valid(resource, file):
"""Check if the content is a readable PNG image."""
try:
with Image.open(file.name, formats=["PNG"]):
return True
except Exception as e:
resource["error"] = str(e)