AxelThevenot / Font_Extractor

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Font_Extractor

Really simple python script to extract every character of a monospace font from an image

How to make the script work ?

What is the use of the script

From an image of the characters of a font, which has to be monospace, it will automatically create a folder with an image for each character. Input image exemple :

image Char Screen

Output images exemple :

char A

char B

char C

char _

How to use it

Google Slide or whatever to create an image

First we need to know exactly what are height dimension in pixel we want for each character's image. For exemple let's say we want images with 128 pixels height and make it very long.

Go to google slide or equivalent.

Then change the dimension of the page as I made for exemple on this slide.

Google Slide Screen

Be sure the font you choose is a monospace one

Then write all the characters you can as above

image Char Screen

Be sure the starting block of the first character is bordered the slide and the last character is taking all the horizontal block (for exemple the _ char on the the image)

Then export it to .png image with the {Font Name}_{ALL_THE_CHARS}.png as instance: {Courier Prime}_{ABCDEFG_}.png by copy pasting the char written in the slide.

And finally move the image into the font_images/ folder and run the python script.

python3 font_extractor.py

You can change the parameter on the top of the script for example for the SIZE = (64, 128) by default.

About


Languages

Language:Python 100.0%