Skip to content

Instantly share code, notes, and snippets.

@samirsaci
Last active October 1, 2022 16:39
Show Gist options
  • Save samirsaci/a8e1e56cfb9217c97245fb1d694bb05f to your computer and use it in GitHub Desktop.
Save samirsaci/a8e1e56cfb9217c97245fb1d694bb05f to your computer and use it in GitHub Desktop.
Graphic Automation
# Open Arrow
arr = Image.open('Img/arrow/{}.png'.format(row['arrow'])).convert("RGBA")
arr = arr.resize((int(arr.size[0]*1.35),int(arr.size[1]*1.35)))
# Paste with Coordinates
bg.paste(arr, (-40, 0), arr)
# Icon 1
zone = Image.open('Img/log/{}.png'.format(row['log'])).convert("RGBA")
perc_size = 0.45
l1, l2 = int(zone.size[0]*perc_size), int(zone.size[1]*perc_size)
zone = zone.resize((l1,l2))
# Paste with coordinates
x1, y1 = 415, 0
bg.paste(zone, (x1, y1), zone)
# Icon 2
zone = Image.open('Img/cat/{}.png'.format(row['cat'])).convert("RGBA")
zone = zone.resize((l1,l2))
# Paste with coordinates
x1, y1 = 415, y1 + l2
bg.paste(zone, (x1, y1), zone)
# Icon 3
zone = Image.open('Img/special/{}.png'.format(row['special'])).convert("RGBA")
zone = zone.resize((l1,l2))
# Paste with coordinates
x1, y1 = 415, y1 + l2
bg.paste(zone, (x1, y1), zone)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment