HOME/Articles/

pil example cvCropPaste (snippet)

Article Outline

Python pil example 'cvCropPaste'

python cvCropPaste

Python pil example: cvCropPaste

#crop and paste image

from PIL import Image
pil_im = Image.open('./data/empire.jpg').convert('L')

#cropping
box = (100,100,400,400)#cropping region
region = pil_im.crop(box)

#pasting
paste_pos = (posStartX, posStartY, width, height)
pil_im.paste(region, box)

#show
pil_im.show()