Last active
December 26, 2015 13:29
-
-
Save masapico/7158745 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| # TrueTypeフォントより登録用のモノクロビットマップ 256x256 を抽出 | |
| from PIL import Image, ImageDraw, ImageFont | |
| # path to *.ttf | |
| ttf_path = './EUDC.TTF' | |
| # 抽出したいコードポイント E000 to F2B3 | |
| cp_start = 57344 | |
| cp_end = 62131 | |
| for i in range(cp_start, (cp_end + 1)): | |
| text_canvas = Image.new('1', (256, 256), (255)) | |
| font = ImageFont.truetype(ttf_path, 256) | |
| ImageDraw.Draw(text_canvas).text((0, 0), chr(i), font=font, fill='#000') | |
| bmp_path = './gaiji_bmp/' + str(i) + '_' + str(hex(i)).upper()[2:] | |
| bmp_path += ".bmp" | |
| text_canvas.save(bmp_path, 'bmp') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment