Skip to content

Unable to open AVIF images #7983

@ponponon

Description

@ponponon

I have a picture here in avif format:https://img10.360buyimg.com/n7/jfs/t1/194600/2/37658/144533/652f464dF8dc6bd47/3aada6e1078054ae.jpg.avif

图片

╭─ponponon@MBP13ARM ~/Pictures
╰─➤  mediainfo jd002.avif
General
Complete name                            : jd002.avif
Format                                   : avif
Codec ID                                 : avif (avif/mif1/miaf/MA1A)
File size                                : 11.4 KiB

Image
ID                                       : 1
Format                                   : av01
Codec ID                                 : av01
Width                                    : 220 pixels
Height                                   : 220 pixels
Color space                              : YUV
Bit depth                                : 8 bits
Stream size                              : 11.1 KiB (98%)
Color range                              : Full
Color primaries                          : BT.709
Transfer characteristics                 : sRGB/sYCC
Matrix coefficients                      : BT.601
Codec configuration box                  : av1C


╭─ponponon@MBP13ARM ~/Pictures
╰─➤  mediainfo --version
MediaInfo Command line,
MediaInfoLib - v24.03

Opening with pillow results in an error

In [1]: from PIL import Image

In [2]: 

In [2]: Image.open('/Users/ponponon/Pictures/jd002.avif')
---------------------------------------------------------------------------
UnidentifiedImageError                    Traceback (most recent call last)
Cell In[2], line 1
----> 1 Image.open('/Users/ponponon/Pictures/jd002.avif')

File ~/.local/share/virtualenvs/image_vector-8oWws01B/lib/python3.10/site-packages/PIL/Image.py:3186, in open(fp, mode, formats)
   3184 for message in accept_warnings:
   3185     warnings.warn(message)
-> 3186 raise UnidentifiedImageError(
   3187     "cannot identify image file %r" % (filename if filename else fp)
   3188 )

UnidentifiedImageError: cannot identify image file '/Users/ponponon/Pictures/jd002.avif'
╰─➤  pip show pillow                                                                                   
Name: Pillow
Version: 9.3.0
Summary: Python Imaging Library (Fork)
Home-page: https://python-pillow.org
Author: Alex Clark (PIL Fork Author)
Author-email: aclark@python-pillow.org
License: HPND
Location: /Users/ponponon/.local/share/virtualenvs/image_vector-8oWws01B/lib/python3.10/site-packages
Requires: 
Required-by: image2vector, ImageHash, torchvision
╰─➤  python --version                                           
Python 3.10.10
╰─➤  sw_vers
ProductName:            macOS
ProductVersion:         14.2.1
BuildVersion:           23C71

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions