Skip to content

Instantly share code, notes, and snippets.

@henryyang42
Created July 24, 2017 11:08
Show Gist options
  • Save henryyang42/a354a218f1d37c5c47c6e83b64767748 to your computer and use it in GitHub Desktop.
Save henryyang42/a354a218f1d37c5c47c6e83b64767748 to your computer and use it in GitHub Desktop.
def make_sticker(url):
response = requests.get(url)
im = Image.open(BytesIO(response.content))
foreground = ImageOps.fit(im, mask.size, centering=(0.5, 0.5))
foreground.putalpha(mask)
background = Image.open("media/background.png")
background.paste(foreground, (1905, 970), foreground)
background.save("media/output.png")
upload_result = client.upload_from_path("media/output.png")
return upload_result['link']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment