The GD Graphics Library is a graphics software library which was developed by Thomas Boutell and other developers for dynamically manipulating images. GD supports numerous programming languages including C, PHP, Perl, Python, OCaml, Tcl, Lua, Pascal, GNU Octave, REXX, and Ruby. In addition, the “Fly” command line interpreter allows for image creation (“on the fly“) using GD. GD scripts can be thus be written in potentially any language and run using this tool.
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. Even more convenient, PHP can output image streams directly to a browser. You will need to compile PHP with the GDlibrary of image functions for this to work. GD and PHP may also require other libraries, depending on which image formats you want to work with.
In this article we have collected a few of the best PHP Image Manipulation Libraries and Class to assist you to simplify your tasks. We hope you will find them helpful towards your image related tasks. Enjoy !!
1. Zebra Image
Zebra_Image is an open source and lightweight image manipulation library built with PHP. The library is object-oriented, requires only the PHP GD2 extension and supports resize, crop, rotate and flip operations. It works with .JPG, .GIF + .PNG formats and can convert one format to another after each action (transparency is preserved as well). For the most-used function, image resizing, there are various methods offered for a smart resize like “keeping the aspect ratio”, “resizing with prioritizing width or height” and “resizing by cropping”. It is also possible to define the quality of .JPG outputs.
2. Imagine
Imagine is an object oriented PHP library for image manipulation built in PHP 5.3. Library can easily manipulate operations on images like resizing, cropping and applying filters. It includes color class which takes two arguments in its constructor to generate RGB code and transparency percentage for any object.
3. Php Graphic Works
WiseLoop PHP Graphic Works is a set of PHP classes designed for image manipulation on the server side. This package allows complex image processing in an easy and flexible manner, by using only a bunch of code. It allows rotate, crop, resize, stretch, and flip operations on images. It includes huge collection of image filters such as blur, sepia, grayscale, negative, contrast, brightness, gamma and many more. It also includes some special effects like puzzle, noise, pixelrate, reflection, emboss edge and sketch.
4. WideImage
Wide Image is an object-oriented library for image manipulation. It requires PHP 5.2+ with GD2 extension. The library provides a simple way to loading, manipulation and saving images in the most common image formats. Wide Image supports all formats that are natively supported by the GD extensions on the server, Wide Image currently supporting GIF, PNG, JPG, GD, GD2, WBMP, XBM, XPM and it also supports BMP and TGA formats.
5. Php5 Image Manipulation
PHP5 Image is a full object-oriented library for an image manipulation by PHP and GD2. It is an extended version of php-image project and can be used either standalone or inside Zend Framework projects. The project currently provides readers for PNG, JPEG, GIF, PSD, ICO image-file types, and outputs all GD2-supported types.
6. Dynamic Dummy Image Generator
Dynamic Dummy Image Generator is a free PHP script that helps creating images with any size, color and text over them.
7. Asido
Asido is a feature-rich image processing class for PHP that fits to any environment like GD2, Magick Wand and Image Magick. It supports both PHP4 & PHP5 (newer versions support only PHP5).
8. PhpThumb
phpThumb is a PHP library that handles all the hard work on creating thumbnails with only few lines of code. It accepts any source types for images (from the filesystem, URL or database) and all popular image formats. Images can be rotated, cropped, watermarked, their quality can be defined and there is even a built-in caching to minimize the server load. phpThumb also has a wide collection of filters including contrast, blur, brightness, applying rounded corners and more.
9. Image Workshop
ImageWorkshop is an open source and free PHP class for managing and manipulating images. The class has an “image-editing-software-like logic” based on layers which enables superposing many layers or even layer groups (with the option of each layer being manipulated differently). It has support for many functions like placing an image (or many images) on another one (good for watermarks), cropping, moving, resizing, rotating (with any degrees), superposing, writing and more. ImageWorkshop works with the GD library, and also, allows us to apply filters provided with the library.
10. Image Cache
Image Cache is a lightweight PHP class that compresses, moves, and caches the image in the user’s browser. After that, it returns the new source of the image to be printed in an image tag which results in a serious gain on load time. The class works by simply setting options like the directory, the base URL, etc. and calling a compress function for each image.