From 8d21415f4ec7e2f8cebb360ef5d88decad3737ce Mon Sep 17 00:00:00 2001 From: bzt Date: Thu, 18 Feb 2021 11:12:36 +0100 Subject: [PATCH] Add support for PNG with palette --- examples/0C_png/png.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/0C_png/png.c b/examples/0C_png/png.c index 79ca821..cbb10f1 100644 --- a/examples/0C_png/png.c +++ b/examples/0C_png/png.c @@ -40,7 +40,7 @@ err: fprintf(stderr, "unable to allocate memory\n"); s.img_buffer_end = s.img_buffer_original_end = buff + size; data = (uint32_t*)stbi__png_load(&s, &w, &h, &l, 0, &ri); if(!data || (l != 3 && l != 4)) { - fprintf(stderr, "Unable to decode png: %s\n", data ? "not RGB format" : stbi__g_failure_reason ); + fprintf(stderr, "Unable to decode png: %s\n", l < 3 ? "not RGB format" : stbi__g_failure_reason ); return 0; } /* if we got 24 bit RGB image, convert it to 32 bit RGBA */