Convert String To Handwritten Text Using Python
How To Python Tips And Tricks

Convert String To Handwritten Text Using Python

Mishel Shaji
Editorial Team
Mishel Shaji, Editorial Team

Python programming language is known for its large number of libraries as packages. Whether it be for Machine Learning, Data Science, or even for usual common tasks, you will find libraries for all your needs. In this post, we'll talk about one such library named PyWhatKit. Using this library, we will learn to convert a string to handwritten text.

What is PyWhatkit?

PyWhatKit is a small library that can be used to perform several tasks like playing YouTube videos, sending WhatsApp messages, finding information about a topic, and much more.

Ankit404butfound/PyWhatKit
Send WhatsApp message at certain time and many other things. - Ankit404butfound/PyWhatKit

It is an open-source project and is available on GitHub. At the time of writing this article, the repository had 207 stars and was forked 62 times.

Installing PyWhatKit

We can install PyWhatKit with PIP using the following command.

pip install pywhatkit

Converting string to handwritten text

Let us now convert a string to handwritten text using this library. Create a new python file and add the following code to it.

import pywhatkit

text = '''
Converting string to handwritten text with PyWhatKit

PyWhatKit is a small library that can be used to perform several tasks like playing 
YouTube videos, sending WhatsApp messages, finding information about a topic, and 
much more. 

It is an open-source project and is available on GitHub. At the time of writing this 
article, the repository had 207 stars and was forked 62 times.
'''
pywhatkit.text_to_handwriting(text)

The output image file will be saved as pywhatkit.png to the current working directory.

We can change the output directory by passing a path as the second parameter to the text_to_handwriting() method.

pywhatkit.text_to_handwriting(text, 'converted.png')

I hope you enjoyed this article. Happy coding.