protected function getOffsetFromEntropy(\Imagick $originalImage, $targetWidth, $targetHeight)
    {
        // The entropy works better on a blured image
        $image = clone $originalImage;
        $image->blurImage(3, 2);

        $size = $image->getImageGeometry();

        $originalWidth = $size['width'];
        $originalHeight = $size['height'];

        $leftX = $this->slice($image, $originalWidth, $targetWidth, 'h');
        $topY = $this->slice($image, $originalHeight, $targetHeight, 'v');

        return array('x' => $leftX, 'y' => $topY);
    }
protected function getOffsetFromEntropy(\Imagick $originalImage, $targetWidth, $targetHeight)
    {
        // The entropy works better on a blured image
        $image = clone $originalImage;
        $image->blurImage(3, 2);

        $size = $image->getImageGeometry();

        $originalWidth = $size['width'];
        $originalHeight = $size['height'];

        $leftX = $this->slice($image, $originalWidth, $targetWidth, 'h');
        $topY = $this->slice($image, $originalHeight, $targetHeight, 'v');

        return array('x' => $leftX, 'y' => $topY);
    }
protected function getOffsetFromEntropy ( \ Imagick $ originalImage , $ targetWidth , $ targetHeight ) { // The entropy works better on a blured image $ image = clone $ originalImage ; $ image -> blurImage ( 3 , 2 ) ; $ size = $ image -> getImageGeometry ( ) ; $ originalWidth = $ size [ 'width' ] ; $ originalHeight = $ size [ 'height' ] ; $ leftX = $ this -> slice ( $ image , $ originalWidth , $ targetWidth , 'h' ) ; $ topY = $ this -> slice ( $ image , $ originalHeight , $ targetHeight , 'v' ) ; return array ( 'x' => $ leftX , 'y' => $ topY ) ; }
Get the offset of where the crop should start

@param  \Imagick $image
@param  int      $targetHeight
@param  int      $targetHeight
@param  int      $sliceSize
@return array
Get the offset of where the crop should start