You are here

function _smartcrop_gd_entropy_slice in Smart Crop 7

Same name and namespace in other branches
  1. 6 imageapi_gd.inc \_smartcrop_gd_entropy_slice()

Compute the entropy of an image slice.

Parameters

$image_data An image object:

$x Starting X coordinate.:

$y Starting Y coordinate.:

$width The width of the slice.:

$height The height of the slice.:

1 call to _smartcrop_gd_entropy_slice()
image_gd_smartcrop_crop in ./image.gd.inc
Crop an image, removing the lowest entropy areas.

File

./image.gd.inc, line 116
libgd implementation of smartcrop action.

Code

function _smartcrop_gd_entropy_slice($image_data, $x, $y, $width, $height) {
  $slice = image_gd_create_tmp($image_data, $width, $height);
  imagecopy($slice, $image_data->resource, 0, 0, $x, $y, $width, $height);
  $entropy = _smartcrop_gd_entropy($slice);
  imagedestroy($slice);
  return $entropy;
}