API Reference

adafruit_bitmapsaver

Save a displayio.Bitmap (and associated displayio.Palette) in a BMP file. Make a screenshot (the contents of a busdisplay.BusDisplay) 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: busdisplay.BusDisplay | framebufferio.FramebufferDisplay | 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. To be supported, a display must implement busdisplay.BusDisplay.fill_row. Known supported display types are busdisplay.BusDisplay and framebufferio.FramebufferDisplay.

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