Skip to content

sweettuse/text_to_image

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

text_to_image

convert text to bitmaps, images, rich, etc

it's kinda hard to take plain text and render it in a font as an image. this helps with that.

(hat tip to @dbader for the hard part - i just added the fun stuff)

so, e.g.

from text_to_image import Face, Font, emojify_text, explore_emojify_text
from rich import print
from rich.color import Color

# simple terminal str
print(Font(Face.menlo, 12).to_str('hello'))

# with color using rich
print(Font(Face.menlo, 12).to_rich('hello', color=Color.parse('purple')))

# emojify text
print(emojify_text('what a great font', font=Font(Face.comic_sans, 12), emoji='saxophone'))

# emojify text more!
print(emojify_text('what a great font', font=Font(Face.comic_sans, 12), emoji='saxophone', flip=True))

# create an image
im = Font(Face.typewriter, 100).to_image('hello!')
im.show()

Screen Shot 2022-12-04 at 12 20 29 PM

Screen Shot 2022-12-04 at 12 21 18 PM

About

convert text to bitmaps, images, rich, etc

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages