pil get imag t code example Example: pil get image type img = Image.open(filename) print(img.format) # 'JPEG'