-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Description
Hi everyone. I found a weird bug. When I try to use "show()" method to display images (that was opened with Image.open) it do not work. I found the problem (but not solution). When the "show()" actually do not open the image it self but rather creates a tmp file and opens it, but the tmp file is created with wrong format / extension (i.e image format is JPEG, but created tmp file is PNG)
what is also weird when I use the "format" function to check if the object has right format it displays right format (JPEG). Nevertheless the tmp file has PNG format.
PS. When I change the tmp file to the right format (via desktop env) then I can normally open the image via Desktop env. Also I can open the png files normally via desktop env but not the ones created by the "show()" function.
And I did tried to manually set the right format for the image but didn't work (which is not surprising because the "format" function shows the right format)
What did you do?
Tried to open images using "show()" function
What did you expect to happen?
I expected that the images will be displayed using default image viewer.
What actually happened?
The image was not displayed.
What are your OS, Python and Pillow versions?
- OS: Arch Linux x86_64
- Kernel: 6.5.9-arch2-1
- Python: 3.11.5
- Pillow: 10.1.0
*Default image viewer: gwenview version: 23.08.2-1
CODE that I used
from PIL import Image
i = Image.open("images/img1.jpeg")
print(i.format)
i.show()IMAGES (actual img, tmp img and visual presentation that tmp files are created with different format)
The opened image: (JPEG)

