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).
The adjustments I want to make are:
- Change the black point to gray and leave the white point white
- Scale all color values to the new range of gray and white
- Replace the transparant background with 100% black
- Transform the image into grayscale
I can get the desired result using a simple command with ImageMagick:
convert input.png +clone +level-colors gray,white -background black -alpha remove -colorspace Gray output.png
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: Is there a -level function in wand-py doesn't apply to my problem, I guess. Because it seems the magick image API doesn't have a level-colors method.
Example result of the effect: