PHPackages                             stojg/crop - 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. stojg/crop

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

stojg/crop
==========

Image cropping classes

1.4.0(6y ago)263470.7k↓56.7%38[7 issues](https://github.com/stojg/crop/issues)3BSD-2PHPPHP &gt;=5.3.0

Since Jun 5Pushed 6y ago3 watchersCompare

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

READMEChangelog (5)DependenciesVersions (22)Used By (3)

Crop
====

[](#crop)

This is a small set of image croppers that I created for testing automated cropping.

[![Build Status](https://camo.githubusercontent.com/c7d3a532713ae4621d3d43d99889663c92078186379d5d1e748bcee835db912e/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f73746f6a672f63726f702e706e673f6272616e63683d6d6173746572)](http://travis-ci.org/stojg/crop)[![Scrutinizer Quality Score](https://camo.githubusercontent.com/224db02975e00f29f76b9296bee109dcb2324439347de040f162091fbaea3e27/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f73746f6a672f63726f702f6261646765732f7175616c6974792d73636f72652e706e673f733d33666239653439353936316462613361653936643936643736333232333665663032323764336362)](https://scrutinizer-ci.com/g/stojg/crop/)[![Code Coverage](https://camo.githubusercontent.com/5f0dd3a31e3ebd5a45bab67f94f29dd93fefad8597dfc41e549ff55149d9106e/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f73746f6a672f63726f702f6261646765732f636f7665726167652e706e673f733d63626435656631356361366634663838366262636438386434356562373963633836313336386363)](https://scrutinizer-ci.com/g/stojg/crop/)

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

[](#requirements)

- PHP 5.3
- Imagemagick where the default colorspace being sRGB (ver 6.7.5-5 or higher)

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

[](#description)

This little project includes three functional image cropers:

### CropCenter

[](#cropcenter)

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

### CropEntropy

[](#cropentropy)

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'

### CropBalanced

[](#cropbalanced)

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

### CropFace

[](#cropface)

Crop face uses [PHP Facedetect Extension](http://www.xarg.org/project/php-facedetect/) (which uses OpenCV).

In details, the FaceCrop uses Entropy Crop but puts blocking "limits" on the faces. If the program faces two limits, we let the entropy decide the best crop.

Usage
-----

[](#usage)

```
$center = new \stojg\crop\CropCenter($filepath);
$croppedImage = $center->resizeAndCrop($width, $height);
$croppedImage->writeimage('assets/thumbs/cropped-center.jpg');
```

###  Health Score

45

—

FairBetter than 91% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity53

Moderate usage in the ecosystem

Community27

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 65.9% 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 ~130 days

Recently: every ~369 days

Total

20

Last Release

2289d ago

Major Versions

1.2.x-dev → 2.0.x-dev2016-03-13

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

2.0.x-devPHP &gt;=5.6.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/ffa59057c23c330890610ea045f407f8cdbc0fa36bde26d5a7a9aa18d5fd5197?d=identicon)[stojg](/maintainers/stojg)

---

Top Contributors

[![jdeniau](https://avatars.githubusercontent.com/u/1398469?v=4)](https://github.com/jdeniau "jdeniau (27 commits)")[![nmcquay](https://avatars.githubusercontent.com/u/79750?v=4)](https://github.com/nmcquay "nmcquay (3 commits)")[![mcuadros](https://avatars.githubusercontent.com/u/1573114?v=4)](https://github.com/mcuadros "mcuadros (2 commits)")[![CheeseSucker](https://avatars.githubusercontent.com/u/1095139?v=4)](https://github.com/CheeseSucker "CheeseSucker (2 commits)")[![christiandavilakoobin](https://avatars.githubusercontent.com/u/46561103?v=4)](https://github.com/christiandavilakoobin "christiandavilakoobin (2 commits)")[![themightychris](https://avatars.githubusercontent.com/u/458494?v=4)](https://github.com/themightychris "themightychris (2 commits)")[![willjosefi](https://avatars.githubusercontent.com/u/222083?v=4)](https://github.com/willjosefi "willjosefi (1 commits)")[![wapmorgan](https://avatars.githubusercontent.com/u/6000618?v=4)](https://github.com/wapmorgan "wapmorgan (1 commits)")[![ecaron](https://avatars.githubusercontent.com/u/70704?v=4)](https://github.com/ecaron "ecaron (1 commits)")

---

Tags

abandonedimage

### Embed Badge

![Health badge](/badges/stojg-crop/health.svg)

```
[![Health](https://phpackages.com/badges/stojg-crop/health.svg)](https://phpackages.com/packages/stojg-crop)
```

###  Alternatives

[intervention/image

PHP Image Processing

14.3k208.9M2.6k](/packages/intervention-image)[league/glide

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

2.6k53.3M146](/packages/league-glide)[liip/imagine-bundle

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

1.7k40.0M248](/packages/liip-imagine-bundle)[spatie/image

Manipulate images with an expressive API

1.4k60.7M188](/packages/spatie-image)[intervention/image-laravel

Laravel Integration of Intervention Image

1588.9M180](/packages/intervention-image-laravel)[intervention/gif

PHP GIF Encoder/Decoder

6128.3M15](/packages/intervention-gif)

PHPackages © 2026

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