I'm trying to reduce the channel-bit-depth of PNGs from 8 to 4 using Magick++. I'm using the following code to do this:
Image * img = new Image("./image8.png");
img->channelDepth(ChannelType::AllChannels,4);
img->write("./image4.png");
For color-images, this works great. But for grayscale images, ImageMagick does something strange. It squeezes the whole content into the left half of the image and displays random pixels in the right half.
turns into this with the code above:
Does anybody have an explanation for this behavior and/or an idea how I can solve this?
Or is this maybe even a bug of image magick?
Magick++ 6.9.2 Q16
– emcconville