public function opacity(&$image, $opacity)
{
if ($image->isAnimated()) {
// Ignore animated GIF for now
return $this;
}
// Bounds checks
$opacity = $opacity > 1 ? 1 : $opacity;
$opacity = $opacity < 0 ? 0 : $opacity;
$image->getCore()->setImageOpacity($opacity);
return $this;
}