Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from PIL import Image
- from random import randint
- import randon
- import os
- def ol(filenamez,num):
- body = Image.open(filenamez).convert("RGBA")
- path = r"/home/jack/Desktop/Images/thegirls/IMGS/"
- base_image = random.choice([
- y for y in os.listdir(path) if y.endswith(".jpg") or y.endswith(".png")
- if os.path.isfile(os.path.join(path, y))
- ])
- filenamez=(path+base_image)
- head = Image.open(filenamez).convert("RGBA")
- w,h = head.size
- UR=randint(20,w-250)
- LR= randint(20,h-150)
- U= randint(25,250)
- L =randint(25,150)
- U= randint(25,250)
- L =randint(25,150)
- UL = UR +U
- LL =LR+L
- headbox= (UR,LR,UL,LL)
- head.crop(headbox).save("head.png")
- head_crop = Image.open("head.png")
- body.paste(head_crop, (UR,LR))
- body.save("out2.png")
- body.save("EXP/"+num+"20out1.png")
- IM = Image.new('RGBA',(1280,720),(0,0,0,0))
- IM.save("out2.png")
- for n in range(1,400):
- num = str(n)
- filenamez = "out2.png"
- ol(filenamez,num)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement