Creating Word Art from an Image with Python

If you are a Python developer, then you can be completely convinced that we can do very interesting things using Python in a very simple way.

Today I will show you a very beautiful use of Python in which we will see how we can create word art of any given image. You can choose your pet image, you can choose natural scenery image, you can choose human image, basically you can choose anything as your image.

Once the image is selected, it’s just a few lines of Python code.

Package

To create Word art, we need to install a package called pywhatkit . If you are using pip to install Python packages, then here is the syntax:

pip install pywhatkit

The code

After installing the package, you need to import the package and call the image_to_ascii_art(…) function. This function will take two parameters – the first is the path to the image file, and the second is the name of the output file.

Here are two lines of code:

import pywhatkit
pywhatkit.image_to_ascii_art(“Wolf.png”,”MyArt”)

When executing the above lines, you will find that a new file named MyArt.txt is being generated.

Sample input image and output

input image

Image Output

I hope you enjoyed creating this Word art.

Similar Posts

Leave a Reply