项目作者: stuartm2

项目描述 :
Simple BMP image reader for MicroPython and CircuitPython
高级语言: Python
项目地址: git://github.com/stuartm2/CircuitPython_BMP_Reader.git
创建时间: 2017-11-08T22:25:38Z
项目社区:https://github.com/stuartm2/CircuitPython_BMP_Reader

开源协议:

下载


Simple BMP image reader for Circuit/MicroPython

This class reads in a simple BMP image returning a multi-dimensional array of
RGB values ideal for displaying with an array of Neopixels.

Installation

Copy lib/bmp_reader.py to the /lib directory on your Circuit/MicroPython device.

Usage

  1. >>> from bmp_reader import BMPReader
  2. >>> img = BMPReader('image.bmp')
  3. >>> img.width
  4. 8
  5. >>> img.height
  6. 8
  7. >>> pixels = img.get_pixels()
  8. >>> pixels[0][0] # top-left
  9. (255, 0, 0)
  10. >>> pixels[7][7] # bottom-right
  11. (0, 255, 255)

For a more complete example displaying the image on an 8x8 Neopixel display, see
example.py.

Image format

This reader only understands very basic aspects of the BMP format. The library
supports images with 24-bit colour depth and no compression. The example
image.bmp file was created in GIMP.