PHP code example of freshleafmedia / image-compression-finder
1. Go to this page and download the library: Download freshleafmedia/image-compression-finder 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/ */
freshleafmedia / image-compression-finder example snippets
use FreshleafMedia\ImageCompressionFinder\ImageCompressionFinder;
$quality = ImageCompressionFinder::make()->run('/path/to/image');
$quality; // 66 (0-100)
$quality = ImageCompressionFinder::make()
->maxDifference(0.001) // The highest acceptable visual change. 0-∞ where 0 is no change at all
->startingQuality(60) // Where to start the search
->driver('imagick') // The driver to use to compress images. Eg imagick or gd
->run();