adafruit_imageload
¶
Load pixel values (indices or colors) into a bitmap and colors into a palette.
Author(s): Scott Shawcroft
- adafruit_imageload.load(file_or_filename, *, bitmap=None, palette=None)¶
Load pixel values (indices or colors) into a bitmap and colors into a palette.
bitmap is the desired type. It must take width, height and color_depth in the constructor. It must also have a _load_row method to load a row’s worth of pixel data.
palette is the desired pallete type. The constructor should take the number of colors and support assignment to indices via [].
adafruit_imageload.bmp
¶
Load pixel values (indices or colors) into a bitmap and colors into a palette from a BMP file.
Author(s): Scott Shawcroft
- adafruit_imageload.bmp.load(file, *, bitmap=None, palette=None)¶
Loads a bmp image from the open
file
.Returns tuple of bitmap object and palette object.
- Parameters
bitmap (object) – Type to store bitmap data. Must have API similar to
displayio.Bitmap
. Will be skipped if Nonepalette (object) – Type to store the palette. Must have API similar to
displayio.Palette
. Will be skipped if None
adafruit_imageload.bmp.indexed
¶
Load pixel values (indices or colors) into a bitmap and colors into a palette from an indexed BMP.
Author(s): Scott Shawcroft
- adafruit_imageload.bmp.indexed.decode_rle(bitmap, file, compression, y_range, width)¶
Helper to decode RLE images
- adafruit_imageload.bmp.indexed.load(file, width, height, data_start, colors, color_depth, compression, *, bitmap=None, palette=None)¶
Loads indexed bitmap data into bitmap and palette objects.
- Parameters
file (file) – The open bmp file
width (int) – Image width in pixels
height (int) – Image height in pixels
data_start (int) – Byte location where the data starts (after headers)
colors (int) – Number of distinct colors in the image
color_depth (int) – Number of bits used to store a value
compression (int) – 0 - none, 1 - 8bit RLE, 2 - 4bit RLE