12월, 2019의 게시물 표시

Basic Cooking #2 - PIL Text

이미지
Hangul(Korean Letter) Processing Quantizing and anti-aliasing Various font effects using PIL Image Processing using PIL If the following error occurs in the process of using TrueType fonts. ImportError : The _imagingft C module is not installed Then reinstall the Pillow like this. sudo apt-get install libfreetype6-dev pip3 uninstall pillow pip3 install pillow Hangul(Korean Letter) Processing Hangul fonts can be used for free Nanum fonts which distributed by Naver or Unicode fonts(Noto Sans CJK KR) downloaded from http://www.google.com/get/noto/#/family/noto-sans-kore . #!/usr/bin/env python #-*- coding: utf-8 -*- #If this code works, it was written by Raspberry.Pi.Maker. #If not, I don't know who wrote it #This file should be saved as UTF-8 format. from PIL import Image, ImageDraw, ImageFont image = Image . new( 'RGB' , ( 400 , 200 ),( 128 , 128 , 128 )) draw = ImageDraw . Draw(image) fnt1 = ImageFont . truetype( './font/Na...