Skip to content
awesome-llama edited this page Apr 7, 2024 · 5 revisions

Previewing

For a quick preview of an image that does not require writing your own code, you can run quick_preview.py to preview the TextImage stored in your system clipboard.

Python Methods

Use the methods defined in image_io.py. An image can be stored as a TextImage object.

  • To create a TextImage object, use load_from_pillow_image() to load from a Pillow Image object. Use Pillow if you want to load an image from a file like PNG or JPG. If you already have a TextImage file, use load_from_text_file() or load_from_text() if it was a Python string.
  • To convert a TextImage object to a Pillow Image object, use the method to_pillow_image() (and from there you can manipulate or save it).
  • To save a TextImage object as a TextImage file, use the save() method or text() if you want it as a Python string.

If you want more control such as creating arbitrary channels, you can use the set_layer() method in a TextImage object.

Python Dependencies

  • Requires Pillow and numpy.
  • pyperclip is used in quick_preview.py but not required anywhere else.
  • Python 3.10 or newer.

Clone this wiki locally