PHP code example of skybluesofa / image-barbershop

1. Go to this page and download the library: Download skybluesofa/image-barbershop 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/ */

    

skybluesofa / image-barbershop example snippets


// Use the Trim class and explicit cut type
$croppedImage = Trim::makeCut('entropy')->onFile('image.jpg')->getResults(200, 200); // \Imagick image
$croppedImage->writeimage('image-cropped.jpg');

// Use the Trim class and explicit cut type
$croppedImage = Trim::makeCut('center')->onFile('image.jpg')->getResults(200, 200); // \Imagick image
$croppedImage->writeimage('image-cropped.jpg');

// Use the Trim class and explicit cut type
$croppedImage = Trim::makeCut('balanced')->onFile('image.jpg')->getResults(200, 200); // \Imagick image
$croppedImage->writeimage('image-cropped.jpg');