force RGB components for all images in imagecompare
Imagemagick produces 1-bit grayscale pngs for fully black pictures. This makes imagecompare unhappy. Enforce the 3-component RGB type for consistency.
This commit is contained in:
parent
ceae5141c1
commit
6995a4cc46
@ -24,7 +24,9 @@ typedef struct {
|
||||
} image_t;
|
||||
|
||||
static int imageLoad(image_t* img, const char *f) {
|
||||
img->data = stbi_load(f, &img->w, &img->h, &img->comp, 0);
|
||||
const int components = 3; // enforce RGB, as magick/png will save empty images as 1-bit grayscale
|
||||
img->data = stbi_load(f, &img->w, &img->h, &img->comp, components);
|
||||
img->comp = components;
|
||||
if (!img->data)
|
||||
fprintf(stderr, "Unable to load image \"%s\"\n", f);
|
||||
return !!(img->data);
|
||||
|
Loading…
x
Reference in New Issue
Block a user