PHP is not limited to creating just HTML output. It can also be used to create and manipulate image files in a variety of different image formats, including GIF, PNG, JPEG, WBMP, and XPM. More here
Even more convenient, PHP can output image streams directly to a browser. You need to install GD Library for this purpose. Simply you can do this.
If you have a LAMP (PHP. APACHE and Mysql) Installation in your System , you can install GD library using the following .