public function roundCorners($width, $height)
{
$this->saveIfRequired('round_corners_canvas');
//creates the mask for rounded corners
$mask = new ImageMagick();
$mask->addConvertOption('size', "{$this->getWidth()}x{$this->getHeight()}")->addConvertOption('draw', "'roundRectangle 0,0 {$this->getWidth()},{$this->getHeight()} {$width},{$height}'");
$mask->addFilter('draw', 'xc:none');
$mask->setWidth($this->getWidth())->setHeight($this->getHeight());
$this->setTmpPaths($mask, 'mask');
$mask->save($mask->getOutputPath());
$mask->imagePath = $mask->getOutputPath();
$this->tmpFiles[] = $mask->getOutputPath();
//create the temp file with rounded corners
$this->addConvertOption('matte', $mask->getOutputPath())->addConvertOption('compose', 'DstIn')->addConvertOption('composite')->addConvertOption('alpha', 'set');
$this->setForceAlpha(true);
//image has to be saved before next actions
$this->saveIfRequired('round_corners');
return $this;
}