DEV Community

Free Python Code
Free Python Code

Posted on

How to convert image to ascii art using Python

Hi πŸ™‚πŸ–

In this post, I will share with you how to convert images to ascii art using Python and a library called ascii-magic.

step 1

install ascii-magic from here pip install ascii-magic

step 2

You need an image file for testing, and I will use this image.

Image description

step 3

from ascii_magic import AsciiArt

ascii_image = AsciiArt.from_image('E.jpg')
ascii_image.to_terminal()
Enter fullscreen mode Exit fullscreen mode

Result

Image description

You can also save it as an HTML file and display it in your browser.

Image description

Now we're done πŸ€—

Don't forget to like and follow πŸ™‚

Support me on PayPal πŸ€—
https://www.paypal.com/paypalme/amr396

Top comments (0)