From 3a108249c056b3c38985d2d3af7ddaf22649c9e2 Mon Sep 17 00:00:00 2001 From: miracade <68456713+miracade@users.noreply.github.com> Date: Tue, 2 Aug 2022 17:01:34 -0700 Subject: [PATCH] Update tex2ngl.py to work for more types of images I recently found that tex2ngl currently doesn't work for images which aren't in RGB or RGBA format (for example, PNGs in indexed mode). PIL's `Image.convert()` method is an easy fix --- tools/tex2ngl.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/tex2ngl.py b/tools/tex2ngl.py index af133d6..8404b07 100755 --- a/tools/tex2ngl.py +++ b/tools/tex2ngl.py @@ -13,7 +13,7 @@ def color2ngl(r, g, b, _=0): def tex2ngl(src): """Converts src to C header containing nGL TEXTURE. Returns tuple(code, object name, tuple(w, h)).""" - img = Image.open(src) + img = Image.open(src).convert("RGBA") width, height = img.size name = ngl_name(os.path.splitext(os.path.basename(src))[0])