public function watermark($file, $offsetX = 0, $offsetY = 0, $opacity = 1.0)
{
$watermark = new \Imagick($this->alias->resolve($file));
if ($watermark->getImageAlphaChannel() === \Imagick::ALPHACHANNEL_UNDEFINED) {
$watermark->setImageOpacity($opacity);
}
if ($watermark->getNumberImages() !== 1) {
throw new ImagickException('not support multiple iterations: `:file`', ['file' => $file]);
}
if (!$this->_image->compositeImage($watermark, \Imagick::COMPOSITE_OVER, $offsetX, $offsetY)) {
throw new ImagickException('Imagick::compositeImage Failed');
}
$watermark->clear();
$watermark->destroy();
return $this;
}