fdintino / pillow-avif-plugin

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

Failed to decode image: BMFF parsing failed - allow no-strict avif decode #28

Open DeviantBadge opened 9 months ago

DeviantBadge commented 9 months ago

Mac Ventura - 13.5 Python - 3.8.18

Hello @fdintino !

If we run following code on attached image:

import pillow_avif
pillow_avif.AvifImagePlugin.AvifImageFile('6963c773e084a08167962a5a05d6.avif')

We will get an error:

Traceback (most recent call last):

  File ~/miniconda3/envs/selenium/lib/python3.8/site-packages/IPython/core/interactiveshell.py:3508 in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)

  Cell In[2], line 1
    pillow_avif.AvifImagePlugin.AvifImageFile('/Users/evgenivorobyev/Downloads/6963c773e084a08167962a5a05d6.avif')

  File ~/miniconda3/envs/selenium/lib/python3.8/site-packages/PIL/ImageFile.py:117 in __init__
    self._open()

  File ~/miniconda3/envs/selenium/lib/python3.8/site-packages/pillow_avif/AvifImagePlugin.py:61 in _open
    self._decoder = _avif.AvifDecoder(

  File <string>
SyntaxError: Failed to decode image: BMFF parsing failed

But if we run console command avifdec with --no-strict option (without it, avifdec also fails with similar error), decoding will finish correctly.

May you add opportunity to turn on --no-strict option?

Image is compressed in zip archive, because github can't handle avif image file: 6963c773e084a08167962a5a05d6.avif.zip

Charlyo commented 1 month ago

Same is happening to me. How should we fix it?