protected function getCenterOffset(\Imagick $image, $targetWidth, $targetHeight)
    {
        $size = $image->getImageGeometry();
        $originalWidth = $size['width'];
        $originalHeight = $size['height'];
        $goalX = (int) (($originalWidth-$targetWidth)/2);
        $goalY = (int) (($originalHeight-$targetHeight)/2);

        return array('x' => $goalX, 'y' => $goalY);
    }
protected function getCenterOffset(\Imagick $image, $targetWidth, $targetHeight)
    {
        $size = $image->getImageGeometry();
        $originalWidth = $size['width'];
        $originalHeight = $size['height'];
        $goalX = (int) (($originalWidth-$targetWidth)/2);
        $goalY = (int) (($originalHeight-$targetHeight)/2);

        return array('x' => $goalX, 'y' => $goalY);
    }
protected function getCenterOffset ( \ Imagick $ image , $ targetWidth , $ targetHeight ) { $ size = $ image -> getImageGeometry ( ) ; $ originalWidth = $ size [ 'width' ] ; $ originalHeight = $ size [ 'height' ] ; $ goalX = ( int ) ( ( $ originalWidth - $ targetWidth ) / 2 ) ; $ goalY = ( int ) ( ( $ originalHeight - $ targetHeight ) / 2 ) ; return array ( 'x' => $ goalX , 'y' => $ goalY ) ; }
Get the cropping offset for the image based on the center of the image

@param  \Imagick $image
@param  int      $targetWidth
@param  int      $targetHeight
@return array
Get the cropping offset for the image based on the center of the image