-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Windows: image with alpha is not displayed correctly #3695
Description
What did you do?
The pillow package has a method called Image.putalpha() which is used to add or change the alpha channel of an image.
I tried to play with this method and found that I can not change the background color of an image. The original image is
This is my code to add alpha to it
from PIL import Image
im_owl = Image.open("owl.jpg")
alpha = Image.new("L", im_owl.size, 50)
im_owl.putalpha(alpha)
im_owl.show()What did you expect to happen?
The produced image shows the effect of adding alpha channel to image.
What actually happened?
The produced image is nothing different from the original image. I have tried with different value of alpha and see no difference.
What are your OS, Python and Pillow versions?
- OS: Windows 10 1803
- Python: 3.6.5
- Pillow: 5.3.0
After consulting the pillow doc about Image.show() method, it seems that pillow will convert the Image object to bmp files and show it with default system image viewer. That explains the reason why no difference between the original and alpha-composited image.
It would be great if the image is shown as its original format, not as bmp files.
