Grafika\Imagick\Editor::_resize PHP Method

_resize() private method

Resize helper function.
private _resize ( Image &$image, integer $newWidth, integer $newHeight ) : self
$image Image
$newWidth integer
$newHeight integer
return self
    private function _resize(&$image, $newWidth, $newHeight)
    {
        if ('GIF' == $image->getType()) {
            // Animated image. Eg. GIF
            $imagick = $image->getCore()->coalesceImages();
            foreach ($imagick as $frame) {
                $frame->resizeImage($newWidth, $newHeight, \Imagick::FILTER_BOX, 1, false);
                $frame->setImagePage($newWidth, $newHeight, 0, 0);
            }
            // Assign new image with frames
            $image = new Image($imagick->deconstructImages(), $image->getImageFile(), $newWidth, $newHeight, $image->getType());
        } else {
            // Single frame image. Eg. JPEG, PNG
            $image->getCore()->resizeImage($newWidth, $newHeight, \Imagick::FILTER_LANCZOS, 1, false);
            // Assign new image
            $image = new Image($image->getCore(), $image->getImageFile(), $newWidth, $newHeight, $image->getType());
        }
    }