You are here

function _smartcrop_gd_entropy_slice in Smart Crop 6

Same name and namespace in other branches
  1. 7 image.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()
imageapi_gd_image_smartcrop_crop in ./imageapi_gd.inc
Crop an image, removing the lowest entropy areas.

File

./imageapi_gd.inc, line 116
libgd implementation of smartcrop action.

Code

function _smartcrop_gd_entropy_slice($image_data, $x, $y, $width, $height) {
  $slice = imageapi_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;
}