diff --git a/adafruit_imageload/bmp/indexed.py b/adafruit_imageload/bmp/indexed.py index e4ffd97..b1943f6 100644 --- a/adafruit_imageload/bmp/indexed.py +++ b/adafruit_imageload/bmp/indexed.py @@ -62,6 +62,8 @@ def load(file, width, height, data_start, colors, color_depth, *, bitmap=None, p bitmap = bitmap(width, height, colors) file.seek(data_start) line_size = width // (8 // color_depth) + if width % (8 // color_depth) != 0: + line_size += 1 if line_size % 4 != 0: line_size += (4 - line_size % 4) diff --git a/examples/images/1bit-not-byte-aligned.bmp b/examples/images/1bit-not-byte-aligned.bmp new file mode 100644 index 0000000..0cad8c7 Binary files /dev/null and b/examples/images/1bit-not-byte-aligned.bmp differ