title: Using +level-colors from ImageMagick in Python with Wand
body: <p>I'm going to use Wand to cut out some parts of an image. The image has a transparent background. But before I cut out the parts, I first want to make some adjustments to the source image (without actually altering the source file).</p>
  
  <p>The adjustments I want to make are:</p>
  
  <ol>
  <li>Change the black point to gray and leave the white point white</li>
  <li>Scale all color values to the new range of gray and white</li>
  <li>Replace the transparant background with 100% black</li>
  <li>Transform the image into grayscale</li>
  </ol>
  
  <p>I can get the desired result using a simple command with ImageMagick:</p>
  
  <p><code>convert input.png +clone +level-colors gray,white -background black -alpha remove -colorspace Gray output.png</code></p>
  
  <p>But how do I do this using Wand? It seems that there's no way to apply the +level-colors operation from Wand. Also the solution from this question: <a href="https://stackoverflow.com/questions/29495217/is-there-a-level-function-in-wand-py">Is there a -level function in wand-py</a> doesn't apply to my problem, I guess. Because it seems the magick image API doesn't have a level-colors method.</p>
  
  <p>Example result of the effect:</p>
  
  <p>Input:
  <a href="https://i.stack.imgur.com/q6Yut.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/q6Yut.jpg" alt="Before"></a>
  Output:
  <a href="https://i.stack.imgur.com/zStWM.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zStWM.jpg" alt="After"></a></p>