This seems to only happen when calling ImageMagick through C code - I was unable to replicate the problem with the same image through the command line convert utility.
A user of PHP Imagick reported this issue. They expected the image to be changed to gray colorspace, but it's not entirely obvious what the correct behaviour should be to me.
Code: Select all
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <malloc.h>
#include <wand/MagickWand.h>
int main(int argc,char **argv) {
MagickWand *magick_wand;
MagickBooleanType status;
MagickWandGenesis();
magick_wand = NewMagickWand();
//This is a color image
status = MagickReadImage(magick_wand, "./Biter_500.jpg");
MagickScaleImage(magick_wand, 16, 16);
MagickQuantizeImage(
magick_wand,
//Changing to 255 makes the image change to grayscale
256,
GRAYColorspace,
0,
0,
0
);
status = MagickWriteImages(magick_wand, "./67258.jpg", MagickTrue);
MagickWandTerminus();
return(0);
}