]> git.tdb.fi Git - libs/gl.git/commitdiff
Correctly handle luminance-only formats in maketex.py
authorMikko Rasa <tdb@tdb.fi>
Wed, 20 Jun 2018 10:36:44 +0000 (13:36 +0300)
committerMikko Rasa <tdb@tdb.fi>
Wed, 20 Jun 2018 10:36:44 +0000 (13:36 +0300)
scripts/maketex.py

index 82a331a9cbbe3af5af0eeb4208b95b8ab09de767..2e1069486585a252584993f0bc3217fcf8131fc3 100755 (executable)
@@ -39,7 +39,10 @@ def make_tex(fn, filter="LINEAR", anisotropy=0, wrap=None, srgb=False):
        data = list(img.getdata())
        for y in range(img.size[1]):
                i = (img.size[1]-1-y)*img.size[0]
-               result += escape("".join(["".join([chr(v) for v in p]) for p in data[i:i+img.size[0]]]))
+               if fmt=="LUMINANCE" or fmt=="SLUMINANCE":
+                       result += escape("".join([chr(v) for v in data[i:i+img.size[0]]]))
+               else:
+                       result += escape("".join(["".join([chr(v) for v in p]) for p in data[i:i+img.size[0]]]))
        result += "\";\n"
 
        return result