File size: 194 Bytes
7896889
 
 
 
 
 
 
 
82dbc73
1
2
3
4
5
6
7
8
9
10
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