></pre></div>
</div>
<div class="section level2">
<h2 id="writing-images">Writing Images<a class="anchor" aria-label="anchor" href="#writing-images"></a>
</h2>
<p>Let’s say we want to set all values greater than 1000 to 1000 and then write the image out. We will use the <code>writenii</code> function. We will copy <code>img</code> to <code>img2</code> because we want to keep <code>img</code> as is. Again we will write the image to a temporary file because we don’t need this after the session:</p>
<div c