Today we are going to build image to ASCII converter in python 3.x. This is going to be very interesting and easy too! So let's get started
What we are going to do?
We will
take any image of our choice and replace every pixel of it by different symbols
like “/”,”@” ,”\”,”$”,etc.
Before writing the code install PIL using the following command: pip install Pillow ==2.2.2
INPUT IMAGE :
Firstly import Python Imaging lib.
Now set the path of the image and then resize it
Then we will firstly convert image to grey scale and then
will get the number of pixels in the given image and then we will create a list
including the symbols from which we want to replace the pixels
Now we will just replace the pixels with the given symbols and you will be able to see the result in your console if everything goes correctly !
OUTPUT IMAGE:
COMPARISON:
SOURCE CODE: HERE
Hope you liked it, do comment and share




Comments
Post a Comment