[PYTHON] pillow

How to use

Pillow 3.1.1

Basic

from PIL import Image as img
im = im.open("{file}")

Information confirmation

im.size # (xx,xx)

Join (?)

Combine multiple images into one Image loading → New campus → Paste by position

a_jpg = im.open("{image_a}") # size(100,100)
b_jpg = im.open("{image_b}") # size(100,100)

canvas = im.new("RGB",(xxx,xxx),(255,255,255))

canvas.paste(a_jpg,(0,0))
canvas.paste(a_jpg,(0,100))
canvas.save('c.jpg', 'JPEG', quality=100, optimize=True)

Recommended Posts

pillow
install pillow
PIL / Pillow cheat sheet
Pillow installation confirmation, IOError