adafruit_bitmapsaver

Save a displayio.Bitmap (and associated displayio.Palette) in a BMP file. Make a screenshot (the contents of a displayio.Display) and save in a BMP file.

  • Author(s): Dave Astels, Matt Land

Implementation Notes

Hardware:

Software and Dependencies:

adafruit_bitmapsaver.rgb565_to_rgb888(rgb565)

Convert from an integer representing rgb565 color into an integer representing rgb888 color. :param rgb565: Color to convert :return int: rgb888 color value

adafruit_bitmapsaver.save_pixels(file_or_filename: str | BufferedWriter, pixel_source: displayio.Display | displayio.Bitmap = None, palette: displayio.Palette | displayio.ColorConverter | None = None) None

Save pixels to a 24 bit per pixel BMP file. If pixel_source if a displayio.Bitmap, save it’s pixels through palette. If it’s a displayio.Display, a palette isn’t required.

Parameters:
  • file_or_filename – either the file to save to, or it’s absolute name

  • pixel_source – the Bitmap or Display to save

  • palette – the Palette to use for looking up colors in the bitmap