Grafika\Imagick\Editor::opacity PHP Method

opacity() public method

Sets the image to the specified opacity level where 1.0 is fully opaque and 0.0 is fully transparent.
public opacity ( Image &$image, float $opacity ) : self
$image Image
$opacity float
return self
    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;
    }