PHPackages                             skybluesofa/image-barbershop - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Image &amp; Media](/categories/media)
4. /
5. skybluesofa/image-barbershop

ActiveLibrary[Image &amp; Media](/categories/media)

skybluesofa/image-barbershop
============================

Smart, automated image cropping

1.3.0(6y ago)02BSD-2PHPPHP &gt;=7.2.0

Since Jun 5Pushed 6y agoCompare

[ Source](https://github.com/skybluesofa/image-barbershop)[ Packagist](https://packagist.org/packages/skybluesofa/image-barbershop)[ Docs](http://github.com/skybluesofa/image-barbershop)[ RSS](/packages/skybluesofa-image-barbershop/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (1)Versions (12)Used By (0)

Crop
====

[](#crop)

This is a small set of automated image croppers.

Requirements
------------

[](#requirements)

- PHP 7.2+ with Imagick extension

Description
-----------

[](#description)

This project includes three functional image cropers:

### CropEntropy

[](#cropentropy)

This is the default crop.

```
// Use the CropEntropy class directly
$croppedImage = (new CropEntropy)->onFile('image.jpg')->getResults(200, 200); // \Imagick image
$croppedImage->writeimage('image-cropped.jpg');

```

or

```
// 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');

```

or

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

```

This class finds the a position in the picture with the most "energy" in it. Energy (or entropy) in images are defined by 'edginess' in the image. For example a image of the sky have low edginess and an image of an anthill has very high edginess.

Energy is in this case calculated like this

1. Take the image and turn it into black and white
2. Run a edge filter so that we're left with only edges.
3. Find a piece in the picture that has the highest entropy (i.e. most edges)
4. Return coordinates that makes sure that this piece of the picture is not cropped 'away'

### CropCenter

[](#cropcenter)

```
// Use the CropCenter class directly
$croppedImage = (new CropCenter)->onFile('image.jpg')->getResults(200, 200); // \Imagick image
$croppedImage->writeimage('image-cropped.jpg');

```

or

```
// 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');

```

This is the most basic of cropping techniques:

1. Find the exact center of the image
2. Trim any edges that is bigger than the targetWidth and targetHeight

### CropBalanced

[](#cropbalanced)

```
// Use the CropBalanced class directly
$croppedImage = (new CropBalanced)->onFile('image.jpg')->getResults(200, 200); // \Imagick image
$croppedImage->writeimage('image-cropped.jpg');

```

or

```
// 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');

```

Crop balanced is a variant of CropEntropy where I tried to the cropping a bit more balanced.

1. Dividing the image into four equally squares
2. Find the most energetic point per square
3. Finding the images weighted mean interest point for all squares

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity2

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 59.1% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~247 days

Recently: every ~591 days

Total

11

Last Release

2255d ago

PHP version history (2 changes)1.0.0PHP &gt;=5.3.0

1.3.0PHP &gt;=7.2.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/60324d72e7a3c7dea85699215cb194d3962647df1e860ae0ec1c6d53858e9a9b?d=identicon)[skybluesofa](/maintainers/skybluesofa)

---

Top Contributors

[![jdeniau](https://avatars.githubusercontent.com/u/1398469?v=4)](https://github.com/jdeniau "jdeniau (13 commits)")[![skybluesofa](https://avatars.githubusercontent.com/u/1657128?v=4)](https://github.com/skybluesofa "skybluesofa (7 commits)")[![mcuadros](https://avatars.githubusercontent.com/u/1573114?v=4)](https://github.com/mcuadros "mcuadros (2 commits)")

---

Tags

image-croppingimage-processingimage

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/skybluesofa-image-barbershop/health.svg)

```
[![Health](https://phpackages.com/badges/skybluesofa-image-barbershop/health.svg)](https://phpackages.com/packages/skybluesofa-image-barbershop)
```

###  Alternatives

[intervention/image

PHP Image Processing

14.3k194.3M2.2k](/packages/intervention-image)[league/glide

Wonderfully easy on-demand image manipulation library with an HTTP based API.

2.6k51.2M116](/packages/league-glide)[liip/imagine-bundle

This bundle provides an image manipulation abstraction toolkit for Symfony-based projects.

1.7k38.3M217](/packages/liip-imagine-bundle)[spatie/image

Manipulate images with an expressive API

1.4k54.4M138](/packages/spatie-image)[intervention/image-laravel

Laravel Integration of Intervention Image

1496.5M102](/packages/intervention-image-laravel)[intervention/gif

PHP GIF Encoder/Decoder

5520.3M9](/packages/intervention-gif)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
