protected function GDOperationTrait::getAreaEntropy in Image Effects 8.3
Same name and namespace in other branches
- 8 src/Plugin/ImageToolkit/Operation/gd/GDOperationTrait.php \Drupal\image_effects\Plugin\ImageToolkit\Operation\gd\GDOperationTrait::getAreaEntropy()
- 8.2 src/Plugin/ImageToolkit/Operation/gd/GDOperationTrait.php \Drupal\image_effects\Plugin\ImageToolkit\Operation\gd\GDOperationTrait::getAreaEntropy()
Computes the entropy of the area of an image.
Parameters
resource $src: The source image resource.
string $x: Starting X coordinate.
string $y: Starting Y coordinate.
string $width: The width of the area.
string $height: The height of the area.
Return value
float The entropy of the selected area image.
2 calls to GDOperationTrait::getAreaEntropy()
- GDOperationTrait::getEntropyCropByGridding in src/
Plugin/ ImageToolkit/ Operation/ gd/ GDOperationTrait.php - Computes the entropy crop of an image, using recursive gridding.
- GDOperationTrait::getEntropyCropBySlicing in src/
Plugin/ ImageToolkit/ Operation/ gd/ GDOperationTrait.php - Computes the entropy crop of an image, using slices.
File
- src/
Plugin/ ImageToolkit/ Operation/ gd/ GDOperationTrait.php, line 387
Class
- GDOperationTrait
- Trait for GD image toolkit operations.
Namespace
Drupal\image_effects\Plugin\ImageToolkit\Operation\gdCode
protected function getAreaEntropy($src, $x, $y, $width, $height) {
// @todo when #2583041 is committed, add a check for memory
// availability before creating the resource.
$window = imagecreatetruecolor($width, $height);
imagecopy($window, $src, 0, 0, $x, $y, $width, $height);
$entropy = GdImageAnalysis::entropy($window);
imagedestroy($window);
return $entropy;
}