from PIL import ImageFont, ImageDraw, Image
count = cv2.imread('/works/icon/count3.png')
fontpath = '/works/fonts/SCDream7.otf'
font_obj = ImageFont.truetype(fontpath, 17)
font_status = ImageFont.truetype(fontpath, 39)
img_pil = Image.fromarray(count)
draw = ImageDraw.Draw(img_pil)
if len(str(_count).replace('.',''))==1:
draw.text((275,50), str(_count), font=font_status, fill=(255,255,255,0))
elif len(str(_count).replace('.',''))==2:
draw.text((255,50), str(_count), font=font_status, fill=(255,255,255,0))
count = np.array(img_pil)
'Tect.tip > Python' 카테고리의 다른 글
[install] conda 설치 (0) | 2022.02.12 |
---|