Pimcore\Image\Adapter\Imagick::applyMask PHP Method

applyMask() public method

public applyMask ( $image ) : self
$image
return self
    public function applyMask($image)
    {
        $this->preModify();
        $image = ltrim($image, "/");
        $image = PIMCORE_DOCUMENT_ROOT . "/" . $image;
        if (is_file($image)) {
            $this->resource->setImageMatte(1);
            $newImage = new \Imagick();
            $newImage->readimage($image);
            $newImage->resizeimage($this->getWidth(), $this->getHeight(), \Imagick::FILTER_UNDEFINED, 1, false);
            $this->resource->compositeImage($newImage, \Imagick::COMPOSITE_COPYOPACITY, 0, 0, \Imagick::CHANNEL_ALPHA);
        }
        $this->postModify();
        $this->setIsAlphaPossible(true);
        return $this;
    }