Imbo\Image\Transformation\Border::expandImage PHP Method

expandImage() private method

Expand the image so that we can fit the width and height of the borders specified on each side, than copy the original image to the center of the canvas.
private expandImage ( string $color, integer $borderWidth, integer $borderHeight, Image $image )
$color string
$borderWidth integer
$borderHeight integer
$image Imbo\Model\Image
    private function expandImage($color, $borderWidth, $borderHeight, Image $image)
    {
        $imageWidth = $image->getWidth();
        $imageHeight = $image->getHeight();
        $original = clone $this->imagick;
        // Clear the original and make the canvas
        $this->imagick->clear();
        $this->imagick->newImage($imageWidth + $borderWidth * 2, $imageHeight + $borderHeight * 2, $color);
        $this->imagick->setImageAlphaChannel(Imagick::ALPHACHANNEL_OPAQUE);
        $this->imagick->setImageFormat($image->getExtension());
        $this->imagick->compositeImage($original, Imagick::COMPOSITE_COPY, $borderWidth, $borderHeight);
    }