Text to Image PHP Script – Demo and Download

In this post we are going to see how to change any TEXT or STRING to PNG image using PHP. PHP comes with an image processing library called GD library. This has many features like creating an image, drawing a TEXT, giving color to the text, making transparent etc., there are plenty of function and those are really easy to understand and write programs.

GD library has to be installed in your Apache server to make this script work!.

Following things you can learn from today’s script (respective functions are written in parentheses):

1. Creating an Image – ( imagecreatetruecolor(); )
2. Finding the bounds for the image – ( ImageTTFBBox() )
3. How to fill the color to the text – ( imagettftext() )
4. How to fill the background color to the text – ( imagefilledrectangle() )
5. Rendering the PNG image on browser – ( imagepng() )

To render an PNG image on browser. The header should be change to image/png.

Here is the script:

Here it the demo and download:



About the Author


Software Engineer, Blogger etc., Visit my Youtube channel - <a href="http://www.youtube.com/agurchand">Click Here</a>

3 thoughts on “Text to Image PHP Script – Demo and Download

Leave a Reply

Your email address will not be published. Required fields are marked *