-
Notifications
You must be signed in to change notification settings - Fork 0
/
thumbs.py
29 lines (20 loc) · 906 Bytes
/
thumbs.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#thumbs.py - functions to work with thumbnails pulled from link pages
from PIL import Image
def youtube_stamp(original_thumb):
background = Image.open(original_thumb)
button = Image.open("youtube_button.png")
# get the alpha-channel (used for non-replacement)
background = background.convert("RGBA")
r,g,b,a = button.split()
# paste the button without replacing the alpha button of the button image
background.paste(button, mask=a)
background.save(original_thumb)
def vimeo_stamp(original_thumb):
background = Image.open(original_thumb)
button = Image.open("vimeo_button.png")
# get the alpha-channel (used for non-replacement)
background = background.convert("RGBA")
r,g,b,a = button.split()
# paste the button without replacing the alpha button of the button image
background.paste(button, mask=a)
background.save(original_thumb)