2017 © Pedro Peláez
 

library crop

Image cropping classes

image

stojg/crop

Image cropping classes

  • Monday, April 24, 2017
  • by stojg
  • Repository
  • 21 Watchers
  • 251 Stars
  • 90,395 Installations
  • PHP
  • 15 Dependents
  • 0 Suggesters
  • 40 Forks
  • 8 Open issues
  • 19 Versions
  • 14 % Grown

The README.md

Crop

This is a small set of image croppers that I created for testing automated cropping., (*1)

Build Status Scrutinizer Quality Score Code Coverage, (*2)

Requirements

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

Description

This little project includes three functional image cropers:, (*3)

CropCenter

This is the most basic of cropping techniques:, (*4)

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

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., (*5)

Energy is in this case calculated like this, (*6)

  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

Crop balanced is a variant of CropEntropy where I tried to the cropping a bit more balanced., (*7)

  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

Crop face uses PHP Facedetect Extension (which uses OpenCV)., (*8)

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., (*9)

Usage

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

The Versions

24/04 2017

dev-master

9999999-dev http://github.com/stojg/crop

Image cropping classes

  Sources   Download

BSD-2

The Requires

  • php >=5.3.0

 

image

24/04 2017

1.3.0

1.3.0.0 http://github.com/stojg/crop

Image cropping classes

  Sources   Download

BSD-2

The Requires

  • php >=5.3.0

 

image

15/03 2017

1.2.11

1.2.11.0 http://github.com/stojg/crop

Image cropping classes

  Sources   Download

BSD-2

The Requires

  • php >=5.3.0

 

image

13/03 2016

2.0.x-dev

2.0.9999999.9999999-dev http://github.com/stojg/crop

Image cropping classes

  Sources   Download

BSD-2

The Requires

  • php >=5.6.0
  • ext-imagick *

 

The Development Requires

image

03/12 2015

1.2.x-dev

1.2.9999999.9999999-dev http://github.com/stojg/crop

Image cropping classes

  Sources   Download

BSD-2

The Requires

  • php >=5.3.0

 

image

25/10 2014

1.2.10

1.2.10.0 http://github.com/stojg/crop

Image cropping classes

  Sources   Download

BSD-2

The Requires

  • php >=5.3.0

 

image

23/10 2014

1.2.9

1.2.9.0 http://github.com/stojg/crop

Image cropping classes

  Sources   Download

BSD-2

The Requires

  • php >=5.3.0

 

image

21/05 2014

1.2.8

1.2.8.0 http://github.com/stojg/crop

Image cropping classes

  Sources   Download

BSD-2

The Requires

  • php >=5.3.0

 

image

08/04 2014

1.2.7

1.2.7.0 http://github.com/stojg/crop

Image cropping classes

  Sources   Download

BSD-2

The Requires

  • php >=5.3.0

 

image

08/12 2013

1.2.6

1.2.6.0 http://github.com/stojg/crop

Image cropping classes

  Sources   Download

BSD-2

The Requires

  • php >=5.3.0

 

image

27/11 2013

1.2.5

1.2.5.0 http://github.com/stojg/crop

Image cropping classes

  Sources   Download

BSD-2

The Requires

  • php >=5.3.0

 

image

18/11 2013

1.2.4

1.2.4.0 http://github.com/stojg/crop

Image cropping classes

  Sources   Download

BSD-2

The Requires

  • php >=5.3.0

 

image

17/09 2013

1.2.3

1.2.3.0 http://github.com/stojg/crop

Image cropping classes

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

image

17/09 2013

1.2.2

1.2.2.0 http://github.com/stojg/crop

Image cropping classes

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

image

07/07 2013

1.2.1

1.2.1.0 http://github.com/stojg/crop

Image cropping classes

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-imagick *

 

image

27/06 2013

1.2.0

1.2.0.0 http://github.com/stojg/crop

Image cropping classes

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-imagick *

 

image

26/06 2013

1.1.1

1.1.1.0 http://github.com/stojg/crop

Image cropping classes

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-imagick *

 

image

26/06 2013

1.1.0

1.1.0.0 http://github.com/stojg/crop

Image cropping classes

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-imagick *

 

image

05/06 2013

1.0.0

1.0.0.0 http://github.com/stojg/crop

Image cropping classes

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-imagick *

 

image