private function expandImage($color, $borderWidth, $borderHeight) {
        $this->imageWidth = $this->image->getWidth();
        $this->imageHeight = $this->image->getHeight();

        $original = clone $this->imagick;

        // Clear the original and make the canvas
        $this->imagick->clear();

        $this->imagick->newImage(
            $this->imageWidth  + ($borderWidth  * 2),
            $this->imageHeight + ($borderHeight * 2),
            $color
        );
        $this->imagick->setImageAlphaChannel(Imagick::ALPHACHANNEL_OPAQUE);
        $this->imagick->setImageFormat($this->image->getExtension());

        $this->imagick->compositeImage(
            $original,
            Imagick::COMPOSITE_COPY,
            $borderWidth,
            $borderHeight
        );
    }
private function expandImage($color, $borderWidth, $borderHeight) {
        $this->imageWidth = $this->image->getWidth();
        $this->imageHeight = $this->image->getHeight();

        $original = clone $this->imagick;

        // Clear the original and make the canvas
        $this->imagick->clear();

        $this->imagick->newImage(
            $this->imageWidth  + ($borderWidth  * 2),
            $this->imageHeight + ($borderHeight * 2),
            $color
        );
        $this->imagick->setImageAlphaChannel(Imagick::ALPHACHANNEL_OPAQUE);
        $this->imagick->setImageFormat($this->image->getExtension());

        $this->imagick->compositeImage(
            $original,
            Imagick::COMPOSITE_COPY,
            $borderWidth,
            $borderHeight
        );
    }
private function expandImage ( $ color , $ borderWidth , $ borderHeight ) { $ this -> imageWidth = $ this -> image -> getWidth ( ) ; $ this -> imageHeight = $ this -> image -> getHeight ( ) ; $ original = clone $ this -> imagick ; // Clear the original and make the canvas $ this -> imagick -> clear ( ) ; $ this -> imagick -> newImage ( $ this -> imageWidth + ( $ borderWidth * 2 ) , $ this -> imageHeight + ( $ borderHeight * 2 ) , $ color ) ; $ this -> imagick -> setImageAlphaChannel ( Imagick :: ALPHACHANNEL_OPAQUE ) ; $ this -> imagick -> setImageFormat ( $ this -> image -> getExtension ( ) ) ; $ this -> imagick -> compositeImage ( $ original , Imagick :: COMPOSITE_COPY , $ borderWidth , $ borderHeight ) ; }
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.

@param string $color
@param integer $borderWidth
@param integer $borderHeight
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 .