Computer Coding Class
1 min readNov 27, 2022

How to Convert Text to Image and Image to Text using Python.

Video Link:-

https://youtu.be/HATkDJcLtlg

In this tutorial we will learn how to convert text to image using NumPy Arrays.

You can encode your secret text code to image and transfer it to any device without any security breach then at receiving point decode the image to original text. Accuracy is 100%.

Basic Concept of this Application is as follows:-

1. Convert Text to List of ASCII Codes.

2. Convert List to 1 Dimensional NumPy Array.

3. Resize 1D to 2D Matrix using NumPy Resize Function.

4. Convert Matrix to Binary Data using PIL Library.

5. Save Binary data as a PNG Image.

6. Show Image using OpenCV.

Then for converting image to text, perform same actions in revers orders.

Main Libraries I used here are:-

  1. PIL
  2. Pillow
  3. NumPy
  4. Time
  5. OpenCV

My Environment is Anaconda.

I used Anaconda Command prompt for the installation of package libraries.

I used PIP and CONDA manager in Virtual Environment for the libraries installation.

*For OpenCV installation, write:-

>>conda install -c anaconda opencv

*For PIL installation, write:-

>>pip install pillow

Subscribe our YouTube Channel for more information:-

https://www.youtube.com/c/ComputerCodingClass

Computer Coding Class

Computer Coding Class
Computer Coding Class

Written by Computer Coding Class

It is a YouTube Channel to learn Computer Coding and Programming in different famous Programming languages like C++, Python, Java from scratch to advanced leveI

No responses yet