Skip to content

Instantly share code, notes, and snippets.

@grampabacon
Last active September 28, 2021 14:38
Show Gist options
  • Save grampabacon/692965e9fea18f3fdd6005155d25e1bb to your computer and use it in GitHub Desktop.
Save grampabacon/692965e9fea18f3fdd6005155d25e1bb to your computer and use it in GitHub Desktop.
create_cat_random_heart
from PIL import Image, ImageDraw
import pathlib
def create_cat_with_heart(id):
image = Image.open("Paper_Cat_Transparent.png")
path = "heart_cats/"
new_image = Image.new("RGB", image.size, get_background_colour())
draw = ImageDraw.Draw(new_image)
draw.rectangle((400, 720, 700, 1000), fill=get_background_colour())
new_image.paste(image, (0, 0), image)
pathlib.Path(path).mkdir(parents=True, exist_ok=True)
new_image.save(path + str(id) + ".png", "PNG")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment