api / app /core /validation.py
Omarelrayes's picture
Upload 3 files
82dbc73 verified
Raw
History Blame Contribute Delete
194 Bytes
import io
from PIL import Image
def is_valid_image(file_bytes: bytes) -> bool:
try:
Image.open(io.BytesIO(file_bytes)).verify()
return True
except:
return False