9951 explained code solutions for 126 technologies


python-pillowHow to change image opacity (transparency)


from PIL import Image

im = Image.open('/var/www/examples/heroine.png')
im.putalpha(100)

im.show()ctrl + c
PIL

import Pillow package modules

Image.open

open given image with Pillow

.putalpha(

change transparency of an image (the higher the value the less the transparency)

.show()

displays resulting image