gfx: 1bpp<->2bpp conversion

this is the simplest way to support 1bpp without rewriting a lot
This commit is contained in:
yenatch
2013-11-14 17:05:13 -05:00
parent f5ad14d634
commit 45d2614aff

View File

@@ -1453,6 +1453,19 @@ def png_to_lz(filein):
def convert_2bpp_to_1bpp(data):
"""
Convert planar 2bpp image data to 1bpp. Assume images are two colors.
"""
return data[::2]
def convert_1bpp_to_2bpp(data):
"""
Convert 1bpp image data to planar 2bpp (black/white).
"""
return type(data)(byte for byte in data for _ in (0, 1))
def mass_to_png(debug=False):
# greyscale