CropCenter

Extends \stojg\crop\Crop

CropCenter

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

Methods

get special offset for class

getSpecialOffset(\Imagick $original, int $targetWidth, int $targetHeight) : array

Arguments

$original

\Imagick

$targetWidth

int

$targetHeight

int

Response

array

Get the cropping offset for the image based on the center of the image

getCenterOffset(\Imagick $image, int $targetWidth, int $targetHeight) : array

Arguments

$image

\Imagick

$targetWidth

int

$targetHeight

int

Response

array

Profiling method

start() 
inherited static

Profiling method

mark() : string
inherited static

Response

string

__construct

__construct(string $imagePath) 
inherited

Arguments

$imagePath

string

  • The path to an image to load. Paths can include wildcards for file names, or can be URLs.

Get the area in pixels for this image

area(\Imagick $image) : int
inherited

Arguments

$image

\Imagick

Response

int

Resize and crop the image so it dimensions matches $targetWidth and $targetHeight

resizeAndCrop(int $targetWidth, int $targetHeight) : boolean|\Imagick
inherited

Arguments

$targetWidth

int

$targetHeight

int

Response

boolean|\Imagick

Returns width and height for resizing the image, keeping the aspect ratio and allow the image to be larger than either the width or height

getSafeResizeOffset(\Imagick $image, int $targetWidth, int $targetHeight) : array
inherited

Arguments

$image

\Imagick

$targetWidth

int

$targetHeight

int

Response

array

Returns a YUV weighted greyscale value

rgb2bw(int $r, int $g, int $b) : int
inherited
see

Arguments

$r

int

$g

int

$b

int

Response

int

getEntropy

getEntropy(array $histogram, int $area) : float
inherited

Arguments

$histogram

array

  • a value[count] array

$area

int

Response

float

Properties

Timer used for profiler / debugging

start_time
inherited static
var

originalImage

originalImage
inherited
var