Image to text converter

This is simple script to convert image to text. User will upload image, set few options and then this image to text converter will print image using characters provided by the user. while googling i found a website where this same image to text converter was implemented, got some free time and made it. wide range of php GD library functions make it more easier to make this image to text converter. simple idea behind this script is to read the image using imagecreatefrompng and read all the pixels, loop through each and every pixel and print it again but not the pixel itself instead of that we will print character/ characters provided by user. while looping through each pixel i am using php gd function imagecolorat which extracts pixel properties and we print the user character with same properties. imagecolorat simply returns RGB values of the pixel.

Image to text converter

Source Image
image to text converter

Output Image
image to text conversion

First version of this Image to text converter was too slow it was because i was reading the uploaded image as it is, so it was taking almost 1-2 minutes to convert image to text and i totally forgot about creating thumbnail :P, i wasted many hours minimizing execution time. Thanks to php thumbnail trick. Below is the code which i am using to create thumbnail, it automatically scales and adjusts image height and width, in case if someone find it useful.

View Demo (Removed)


Leave a Comment


Notify me of followup comments via e-mail. You can also subscribe without commenting.


Let your friends know what are you reading

Share this post with your friends!