quick_test () from_image()Ĭreates an AsciiArt object from an image file. quick_test () -> NoneĮxample: from ascii_magic import AsciiArt AsciiArt. Loads a random Unsplash picture with the default parameters and prints it to the terminal, allowing you to verify in a single line of code that everything is running O.K. The property AsciiArt.image exposes the underlying Pillow object so you can manipulate it directly.Įxample: from ascii_magic import AsciiArt from PIL import ImageEnhance my_art = AsciiArt. This class is essentially a wrapper for a Pillow image. to_terminal () # Does the same as this: my_art = from_image ( 'lion.jpg' ) my_art. These methods have parameters such as columns that allow you to change the appearance of the art piece.įor convenience, the module ascii_magic also exposes a collection of functions with the same name as the class methods mentioned above, which do exactly the same.Įxample: from ascii_magic import AsciiArt, from_image # This: my_art = AsciiArt. These objects have multiple methods, such as my_art.to_terminal(), that generate ASCII art pieces from the picture. This module's entire functionality is contained within the class AsciiArt, which has a collection class methods, such as om_image(), that return AsciiArt objects with pictures from different sources: files, URLs, the clipboard, etc. Quickstart from ascii_magic import AsciiArt my_art = AsciiArt.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |