1. Go to this page and download the library: Download cleup/pixie library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
cleup / pixie example snippets
use Cleup\Pixie\ImageManager;
// Create from file with auto driver detection
$image = ImageManager::createFromPath('input.jpg');
// To optimize GIF performance, use Gifsicle
$image
// Gifsicle will be available if installed
->useGifsicle()
// If you want to get a minimum file size, you can select a value from 1 to 100.
// The higher this value, the smaller the file size will be, but the frame quality may deteriorate.
->setGifsicleLossy(80);
// Allow upscaling - we do not recommend enabling it without need.
$image->upcale(true); // Default = false
// Resize and save
$image->resize(800, 600)
->save('output.jpg', 90);
// Create thumbnail
$image->fit(200, 200)
->greyscale()
->save('/path/to/thumbnail.jpg');
use Cleup\Pixie\Image;
// With specific driver
$image = new Image('imagick'); // or 'gd'
$image->load('input.png')
->resize(400, 300)
->save('/path/to/output.webp', 85, 'webp');
// Save with default quality
$image->save('output.jpg');
// Save with specific quality and format
$image->save('output.webp', 85, 'webp');
// Output directly to browser
$image->output('jpeg', 90);
// Get as binary string
$binaryData = $image->toString('png', 100);
// Basic resize
$image->resize(800, 600);
// Resize with aspect ratio preservation (default)
$image->resize(800, 600, true);
// Resize to specific width/height
$image->resizeToWidth(400);
$image->resizeToHeight(300);
// Scale by ratio
$image->scale(0.5); // 50% scale
// Fit within dimensions
$image->resizeToFit(1024, 768);
// Fill dimensions (crop to fit)
$image->resizeToFill(200, 200);
// Crop with coordinates
$image->crop(100, 100, 400, 300);
// Fit and crop to exact dimensions
$image->fit(300, 300);