Zebra image is a lightweight PHP library that provides methods for several types of image manipulation. The library doesn’t require any external plugins or any other code snippets using only the GD2 extension (usually PHP comes pre-compiled with this extension). Zebra Image is very well commented and generates no warning, errors or notices when PHP error reporting level is set to E_ALL.
This PHP image manipulation library supports rescale, flip, rotate or crop functions but also loading and saving images in different image formats like GIF, JPEG or PNG. It also preserves transparency for GIF, PNG or PNG24. Zebra Image provides some cool features like re-sizing images to exact given width and height and still maintain aspect ratio. The image can be scaled to fit in a box with given width and height and then be centered both horizontally and vertically in the box (the blank area will be filled with a specified color) but provides also other great scaling options.
PHP Image manipulation library example