Fix bug decoding i4 and i8 images
@@ -183,21 +183,19 @@ def convert_color_to_ia8(color):
return ia8
def convert_i4_to_color(i4):
- r = g = b = i4*0x11
- a = 255
+ r = g = b = a = i4*0x11
return (r, g, b, a)
def convert_color_to_i4(color):
r, g, b, a = get_rgba(color)
- assert r == g == b
+ assert r == g == b == a
i4 = 0
i4 |= ((r >> 4) & 0xF)
return i4
def convert_i8_to_color(i8):
- r = g = b = i8
- a = 255
+ r = g = b = a = i8
return (r, g, b, a)
