protected function processOverlay(ImageMagick $overlayImage, $composite = "COMPOSITE_DEFAULT", $x = 0, $y = 0, $overlayOpacity = 100)
{
//sets a value used by the compose option
$allowedComposeOptions = ['hardlight', 'exclusion'];
$composite = strtolower(substr(strrchr($composite, "_"), 1));
$composeVal = in_array($composite, $allowedComposeOptions) ? $composite : 'dissolve';
//save current state of the thumbnail to the tmp file
$this->saveIfRequired('compose');
$this->setForceAlpha(true);
$this->addConvertOption('compose', $composeVal)->addConvertOption('geometry', "{$overlayImage->getWidth()}x{$overlayImage->getHeight()}+{$x}+{$y}")->addConvertOption('define', "compose:args={$overlayOpacity},100")->addConvertOption('composite')->addFilter('compose', $overlayImage->imagePath);
$this->save($this->getOutputPath());
return $this;
}