Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not work with Pillow 10.1, ImageFile.mode can no longer be set directly #22

Open
ran404 opened this issue Nov 21, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@ran404
Copy link

ran404 commented Nov 21, 2023

Describe the bug

Does not work with Pillow 10.1. The attribute ImageFile.mode can no longer be set directly.

This is the same issue as: imageio/imageio#1044

I can get it work by monkeypatching the HeifImageFile._open function, changing the line:

self.mode = heif_file.mode

to

self._mode = heif_file.mode

but would be good to have a proper fix.

Steps to reproduce

import HeifImagePlugin
from PIL import Image, ImageOps

with Image.open('some-heic-file.heic') as image:
    # raises exception here

Code / screenshots

  File "/opt/venvs/python/lib/python3.11/site-packages/PIL/Image.py", line 3284, in open
    im = _open_core(fp, filename, prefix, formats)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venvs/python/lib/python3.11/site-packages/PIL/Image.py", line 3270, in _open_core
    im = factory(fp, filename)
         ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venvs/python/lib/python3.11/site-packages/PIL/ImageFile.py", line 117, in __init__
    self._open()
  File "/opt/venvs/python/lib/python3.11/site-packages/HeifImagePlugin.py", line 117, in _open
    self.mode = heif_file.mode
    ^^^^^^^^^
AttributeError: property 'mode' of 'HeifImageFile' object has no setter

Environment

  • Library version: heif-image-plugin==0.6.0
  • Language/framework version: Python 3.11.5
  • OS version: CentOS 7.9
@ran404 ran404 added the bug Something isn't working label Nov 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

1 participant