fdintino / pillow-avif-plugin

A pillow plugin that adds avif support via libavif
BSD 2-Clause "Simplified" License
77 stars 12 forks source link

SyntaxError: not a TIFF file #3

Closed imfantuan closed 3 years ago

imfantuan commented 3 years ago
import os
import xml.etree.ElementTree
from contextlib import contextmanager
from io import BytesIO

try:
    from os import cpu_count
except ImportError:
    from multiprocessing import cpu_count

try:
    from unittest import mock
except ImportError:
    import mock

import pytest

from PIL import Image
from pillow_avif import AvifImagePlugin

#from .helper import (
#    PillowLeakTestCase,
#    assert_image,
#    assert_image_similar,
#    assert_image_similar_tofile,
#    hopper,
#)

from pillow_avif import _avif

try:
    from PIL import UnidentifiedImageError
except ImportError:
    UnidentifiedImageError = None

with Image.open("/root/Ronda.avif") as im:
    exif = im.getexif()
print(exif)

It shows:

Traceback (most recent call last):
  File "tests/2_test_file_avif.py", line 37, in <module>
    exif = im.getexif()
  File "/usr/local/python3/lib/python3.8/site-packages/PIL/Image.py", line 1275, in getexif
    self._exif.load(self.info.get("exif"))
  File "/usr/local/python3/lib/python3.8/site-packages/PIL/Image.py", line 3237, in load
    self._info = TiffImagePlugin.ImageFileDirectory_v1(self.head)
  File "/usr/local/python3/lib/python3.8/site-packages/PIL/TiffImagePlugin.py", line 900, in __init__
    super().__init__(*args, **kwargs)
  File "/usr/local/python3/lib/python3.8/site-packages/PIL/TiffImagePlugin.py", line 466, in __init__
    raise SyntaxError("not a TIFF file (header %r not valid)" % ifh)
SyntaxError: not a TIFF file (header b'\x00\x00\x01\x00i\x87\x04\x00' not valid)

Ronda.avif.zip

imfantuan commented 3 years ago

fixed in pillow 8.2