<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Sets the image opacity level</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="imagick.setimagemattecolor.html">Imagick::setImageMatteColor</a></div> <div class="next" style="text-align: right; float: right;"><a href="imagick.setimageorientation.html">Imagick::setImageOrientation</a></div> <div class="up"><a href="class.imagick.html">Imagick</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="imagick.setimageopacity" class="refentry"> <div class="refnamediv"> <h1 class="refname">Imagick::setImageOpacity</h1> <p class="verinfo">(PECL imagick 2.0.0)</p><p class="refpurpose"><span class="refname">Imagick::setImageOpacity</span> — <span class="dc-title">Sets the image opacity level</span></p> </div> <div class="refsect1 description" id="refsect1-imagick.setimageopacity-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">bool</span> <span class="methodname"><strong>Imagick::setImageOpacity</strong></span> ( <span class="methodparam"><span class="type">float</span> <code class="parameter">$opacity</code></span> )</div> <p class="para rdfs-comment"> Sets the image to the specified opacity level. This method is available if Imagick has been compiled against ImageMagick version 6.3.1 or newer. This method operates on all channels, which means that for example opacity value of 0.5 will set all transparent areas to partially opaque. To add transparency to areas that are not already transparent use <a href="imagick.evaluateimage.html" class="link">Imagick::evaluateImage()</a> </p> </div> <div class="refsect1 parameters" id="refsect1-imagick.setimageopacity-parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><em><code class="parameter">opacity</code></em></span> <dd> <p class="para"> The level of transparency: 1.0 is fully opaque and 0.0 is fully transparent. </p> </dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues" id="refsect1-imagick.setimageopacity-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Returns <strong><code>TRUE</code></strong> on success. </p> </div> <div class="refsect1 examples" id="refsect1-imagick.setimageopacity-examples"> <h3 class="title">Examples</h3> <p class="para"> <div class="example" id="example-3339"> <p><strong>Example #1 A <span class="function"><strong>Imagick::setImageOpacity()</strong></span> example</strong></p> <div class="example-contents"><p> An example of using Imagick::setImageOpacity() </p></div> <div class="example-contents"> <div class="phpcode"><code><span style="color: #000000"> <span style="color: #0000BB"><?php<br /></span><span style="color: #FF8000">/* Create the object */<br /></span><span style="color: #0000BB">$image </span><span style="color: #007700">= new </span><span style="color: #0000BB">Imagick</span><span style="color: #007700">(</span><span style="color: #DD0000">'source.png'</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">/* Set the opacity */<br /></span><span style="color: #0000BB">$image</span><span style="color: #007700">-></span><span style="color: #0000BB">setImageOpacity</span><span style="color: #007700">(</span><span style="color: #0000BB">0.7</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">/* output the image */<br /></span><span style="color: #0000BB">header</span><span style="color: #007700">(</span><span style="color: #DD0000">'Content-type: image/png'</span><span style="color: #007700">);<br />echo </span><span style="color: #0000BB">$image</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">?></span> </span> </code></div> </div> </div> </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="imagick.setimagemattecolor.html">Imagick::setImageMatteColor</a></div> <div class="next" style="text-align: right; float: right;"><a href="imagick.setimageorientation.html">Imagick::setImageOrientation</a></div> <div class="up"><a href="class.imagick.html">Imagick</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>