What is Grafika?

Grafika is an advance image processing and graphics library for PHP.

Download .zip Github

Why Grafika?

Why another image manipulation lib? There are a bazillion other libs for PHP already, why reinvent the wheel? Well...

Unique Features

These are the features that makes Grafika unique from other libs:

Basic Filters

Grafika also support the basic filters commonly found in other libs:

See Filters section for more info.

Drawing Objects

See Drawing Objects section for more info.

Easy Image Manipulation

Grafika makes it easier to do image manipulation in PHP.

Consider the following code using PHP's default built-in image lib, GD.
It will resize a jpeg image to exactly 200x200 pixels:

$gd = imagecreatefromjpeg( 'path/to/jpeg/image.jpg' ); // Open jpeg file

$newImage = imagecreatetruecolor(200, 200); // Create a blank image

// Resize image to 200x200
imagecopyresampled(
    $newImage,
    $gd,
    0,
    0,
    0,
    0,
    200,
    200,
    imagesx($gd),
    imagesy($gd)
);

imagedestroy($gd); // Free up memory

imagejpeg( $newImage, 'path/to/edited.jpg', 90 ); // Save resized image with 90% quality

imagedestroy($newImage); // Free up memory
            

Now consider doing the same using grafika:

use Grafika\Grafika;

$editor = Grafika::createEditor();

$editor->open( $image, "path/to/jpeg/image.jpg" );
$editor->resizeExact( $image, 200, 200 );
$editor->save( $image, "path/to/edited.jpg", null, 90 );

You can even chain the api calls (think jQuery):

use Grafika\Grafika;

Grafika::createEditor()
        ->open( $image, "path/to/jpeg/image.jpg" )
        ->resizeExact( $image, 200, 200 )
        ->save( $image, "path/to/edited.jpg", null, 90 );

See docs for more info.