9951 explained code solutions for 126 technologies


python-pillowHow to create an image


from PIL import Image, ImageFilter

im = Image.new(mode='RGB', size=(100,100), color=(100,50,150))

im.show()ctrl + c
PIL

import Pillow package modules

Image.new

create new PIL image object

mode='RGB'

create new image in RGB color mode

(100,100)

new image will be 100x100

(100,50,150)

color to use for background in RGB tuple form

.show()

displays resulting image