Old browsers
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
from PIL import Image, ImageDraw
|
||||
|
||||
# 1. Generate icon_bg.png (56x56)
|
||||
img_icon = Image.new('RGBA', (56, 56), (0, 0, 0, 0))
|
||||
draw = ImageDraw.Draw(img_icon)
|
||||
|
||||
# Fill circle
|
||||
# circle bounding box: [0, 0, 55, 55]
|
||||
# color: rgba(0,0,0, 0.22) => alpha = int(0.22 * 255) = 56
|
||||
draw.ellipse([0, 0, 55, 55], fill=(0, 0, 0, 56))
|
||||
|
||||
# Outline circle
|
||||
# color: rgba(224, 160, 91, 0.45) => alpha = int(0.45 * 255) = 115
|
||||
draw.ellipse([0, 0, 55, 55], outline=(224, 160, 91, 115), width=1)
|
||||
|
||||
img_icon.save('icon_bg.png')
|
||||
|
||||
# 2. Generate grid.png (24x24)
|
||||
# 1px top and left lines, rgba(255, 255, 255, 0.02)
|
||||
# Wait, 0.02 is very faint (alpha = 5). Let's make it alpha=8 for visibility.
|
||||
img_grid = Image.new('RGBA', (24, 24), (0, 0, 0, 0))
|
||||
draw_grid = ImageDraw.Draw(img_grid)
|
||||
|
||||
line_color = (255, 255, 255, 8)
|
||||
# Left line
|
||||
draw_grid.line([(0, 0), (0, 23)], fill=line_color, width=1)
|
||||
# Top line
|
||||
draw_grid.line([(0, 0), (23, 0)], fill=line_color, width=1)
|
||||
|
||||
img_grid.save('grid.png')
|
||||
|
||||
Reference in New Issue
Block a user