-
Notifications
You must be signed in to change notification settings - Fork 0
Usage
awesome-llama edited this page Apr 7, 2024
·
5 revisions
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.
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, useload_from_text_file()orload_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 ortext()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.
- Requires Pillow and numpy.
- pyperclip is used in
quick_preview.pybut not required anywhere else. - Python 3.10 or newer.
