aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJan200101 <sentrycraft123@gmail.com>2023-09-06 11:37:16 +0200
committerJan200101 <sentrycraft123@gmail.com>2023-09-06 11:37:16 +0200
commit005f8d3797a844c892e53d71cd5ae8855dc4bed6 (patch)
treeaf15f26f3e8d5c1ed0dc05a48a5152606e67ebbf /src
parent3822d1b0d54efca5d8ec1b27064edf50bf34dd72 (diff)
downloadsameboy-thumbnailer-005f8d3797a844c892e53d71cd5ae8855dc4bed6.tar.gz
sameboy-thumbnailer-005f8d3797a844c892e53d71cd5ae8855dc4bed6.zip
convert grayscale templates to RGB
Diffstat (limited to 'src')
-rw-r--r--src/image.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/image.c b/src/image.c
index dd52b95..d93ee5f 100644
--- a/src/image.c
+++ b/src/image.c
@@ -1,3 +1,5 @@
+#include <stdio.h>
+
#include "image.h"
#include "common.h"
@@ -28,7 +30,14 @@ unsigned decode32(uint32_t** out, unsigned* w, unsigned* h,
png_byte color_type = png_get_color_type(png, info);
if(color_type == PNG_COLOR_TYPE_PALETTE)
+ {
png_set_palette_to_rgb(png);
+ }
+ else if (color_type == PNG_COLOR_TYPE_GRAY_ALPHA
+ || color_type == PNG_COLOR_TYPE_GRAY)
+ {
+ png_set_gray_to_rgb(png);
+ }
if(png_get_valid(png, info, PNG_INFO_tRNS))
png_set_tRNS_to_alpha(png);