PHP Library for Comparing Images & Advanced Filters

Open Source PHP API includes support for image comparison,  smart cropping, image blending, GIF animation, 5 resize modes, and many more.

Grafika is very easy to use and powerful image processing PHP library that is blended with some unique features enabling software developers to create and manipulate their images and graphics inside their PHP applications. Grafika is based on Imagick and GD, so there is no need to worry about the differences between GD and Imagick API, Grafika normalizes these operations for you and makes your job easy.

The Grafika library has provided support for basic as well as several advance image creation and processing features. The library can be used to generate image thumbnails quickly and having very high quality.  The library has also included support for intelligent tailoring as well as image attribute processing with just a couple of lines of code.

The Grafika library contains some advanced features that make it unique from other available PHP libraries, such as applying smart cropping, compare images, advance filters, image blending, animated GIF support, 5 resize modes and more. It has also included support for some common features like image cloning, create blank images, make a copy of the image, apply watermark on the image, and many more.<

Previous Next

Getting Started with Grafika

The recommended way to install Grafika is via Composer. Inside your project directory, open the command line and type the following command to install it.

Install Grafika via composer

$ composer require kosinix/grafika:dev-master --prefer-dist

Images Creation via PHP APIs

The open source Grafika library allows software developers to generate different kinds of images inside their own PHP application with a couple of lines of code. The most common way of making an image is by using the editor's open method.  You easily create a blank image as well as create a copy of an image using the clone keyword inside your code.  Moreover, you can also blend, fill, flip, set opacity as well as resize and crop images with ease.

Compare Images inside PHP Apps

The Grafika library gives software programmers the power to programmatically compare their images inside their own apps.  It can compare the similarity between two images as well as gives you the ability to determine if the two images are equal or not. The great thing is that it can do a pixel by pixel comparison to determine if two images are exactly the same. It will compare if the two images are of the same width and height. If the dimensions differ, it will return false. If the dimensions are equal, it will loop through each pixel. If one of the pixels don't match, it will return false. The pixels are compared using their RGB (Red, Green, Blue) values.

Smart Image Cropping

Image cropping is the removal of undesirable areas from a photographic or image. Cropping can be used to make the image size reduced or change the aspect ratio of an available image. The Grafika library has included features for basic as well as smart cropping via PHP. The smart cropping feature is very useful and where the library decides the crop position with the important regions of the images preserved.

Animated GIF Support

The animated GIFs are animated images that are most commonly used on the internet because of their simple creation and smaller file size which allows faster upload time.  The Grafika has included limited support for animated GIFs. It allows resizing animated GIFs either on GD or Imagick and preserving its animation during the resizing process. It also supports flattening an animated GIF which means that the GIF will be converted to just a regular GIF and the animation will be removed.