Demo entry 2742886

Cat Crop

   

Submitted by anonymous on Sep 24, 2015 at 13:00
Language: Python 3. Code size: 534 Bytes.

from PIL import Image
catIm = Image.open("automate_online-materials/zophie.png")
faceIm = catIm.crop((335,345,565,560))
# height, width variables
catImWidth, catImHeight = catIm.size
faceImWidth, faceImHeight = faceIm.size

resultIm = catIm.copy()

print("Face Width: " + str(faceImWidth))
print("Face Height: "  + str(faceImHeight))

for left in range(0, catImWidth, faceImWidth):
	for top in range(0, catImHeight, faceImHeight):
		print(left, top)
		resultIm.paste(faceIm, (left,top))

resultIm.save("catfaces.png")

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).