Created
July 24, 2017 11:08
-
-
Save henryyang42/a354a218f1d37c5c47c6e83b64767748 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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