Created
May 27, 2020 06:49
-
-
Save a2chub/d7663f94616eb5eb35565ab6ff83460a 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
from PIL import Image | |
from PIL import ImageDraw | |
from PIL import ImageFont | |
call_sign = "JI1SVR" | |
# base image | |
im = Image.new("RGB",(288, 72),"#00ff00") | |
palettedata = [0,0,0, 0,255,0, 255,255,255] | |
font_size = 20 | |
fnt_reg = ImageFont.truetype('./fonts/Nasu-Regular-20200227.ttf', font_size) | |
fnt_bld = ImageFont.truetype('./fonts/Nasu-Bold-20200227.ttf', font_size-1) | |
draw = ImageDraw.Draw(im) | |
shadow_shift = 0 | |
draw.text((0 + shadow_shift, 32+shadow_shift),call_sign, font=fnt_bld, fill=(0,0,0)) | |
draw.text((0, 32),call_sign, font=fnt_reg) | |
im.save("./with_CS.png") | |
im2 = Image.open("./with_CS.png") | |
im2.quantize(3, kmeans=True).convert("RGB") | |
im2.save("./with_CS_four.png") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment