-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Open
Description
What did you do?
Attempted to use Image.filter(ImageFilter.BLUR) on an image of mode I or I;16
What did you expect to happen?
Image is blurred
What actually happened?
Code throws ValueError
What are your OS, Python and Pillow versions?
- OS: Windows 10 Home
- Python: 3.10.1
- Pillow: 9.2.0
>>> from tkinter import filedialog
>>> from PIL import Image, ImageFilter
>>> image1 = Image.open(filedialog.askopenfilename())
>>> image1
<PIL.BmpImagePlugin.BmpImageFile image mode=RGB size=630x514 at 0x28B7051E9B0>
>>> image2 = image1.convert('I')
>>> image2
<PIL.Image.Image image mode=I size=630x514 at 0x28B70A8E560>
>>> image1.filter(ImageFilter.BLUR).show()
>>> image2.filter(ImageFilter.BLUR).show()
Traceback (most recent call last):
File "<pyshell#56>", line 1, in <module>
image2.filter(ImageFilter.BLUR).show()
File "C:\Users\x\AppData\Local\Programs\Python\Python310\lib\site-packages\PIL\Image.py", line 1247, in filter
return self._new(filter.filter(self.im))
File "C:\Users\x\AppData\Local\Programs\Python\Python310\lib\site-packages\PIL\ImageFilter.py", line 32, in filter
return image.filter(*self.filterargs)
ValueError: image has wrong modeMetadata
Metadata
Assignees
Labels
No labels