adafruit-circuitpython-bitmapsaver


Nameadafruit-circuitpython-bitmapsaver JSON
Version 1.3.0 PyPI version JSON
download
home_page
SummarySave a displayio.Bitmap (and associated displayio.Palette) into a BMP file.
upload_time2024-02-22 23:02:50
maintainer
docs_urlNone
author
requires_python
licenseMIT
keywords adafruit blinka circuitpython micropython bitmapsaver displayio
VCS
bugtrack_url
requirements Adafruit-Blinka
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Introduction
============

.. image:: https://readthedocs.org/projects/adafruit-circuitpython-bitmapsaver/badge/?version=latest
    :target: https://docs.circuitpython.org/projects/bitmapsaver/en/latest/
    :alt: Documentation Status

.. image:: https://raw.githubusercontent.com/adafruit/Adafruit_CircuitPython_Bundle/main/badges/adafruit_discord.svg
    :target: https://adafru.it/discord
    :alt: Discord

.. image:: https://github.com/adafruit/Adafruit_CircuitPython_BitmapSaver/workflows/Build%20CI/badge.svg
    :target: https://github.com/adafruit/Adafruit_CircuitPython_BitmapSaver/actions/
    :alt: Build Status

.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
    :target: https://github.com/psf/black
    :alt: Code Style: Black

Save a displayio.Bitmap (and associated displayio.Palette) into a BMP file.


Dependencies
=============
This driver depends on:

* `Adafruit CircuitPython <https://github.com/adafruit/circuitpython>`_

CircuitPython 5.0 or later is required.

Please ensure all dependencies are available on the CircuitPython filesystem.
This is easily achieved by downloading
`the Adafruit library and driver bundle <https://github.com/adafruit/Adafruit_CircuitPython_Bundle>`_.

Installing from PyPI
=====================
.. note:: This library is not available on PyPI yet. Install documentation is included
   as a standard element. Stay tuned for PyPI availability!

On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally `from
PyPI <https://pypi.org/project/adafruit-circuitpython-bitmapsaver/>`_. To install for current user:

.. code-block:: shell

    pip3 install adafruit-circuitpython-bitmapsaver

To install system-wide (this may be required in some cases):

.. code-block:: shell

    sudo pip3 install adafruit-circuitpython-bitmapsaver

To install in a virtual environment in your current project:

.. code-block:: shell

    mkdir project-name && cd project-name
    python3 -m venv .venv
    source .venv/bin/activate
    pip3 install adafruit-circuitpython-bitmapsaver

Usage Example
=============

.. code-block:: python

    import board
    import busio
    import digitalio
    from displayio import Bitmap, Palette
    import adafruit_sdcard
    import storage
    from adafruit_bitmapsaver import save_pixels

    print('Setting up SD card')
    spi = busio.SPI(board.SCK, MOSI=board.MOSI, MISO=board.MISO)
    cs = digitalio.DigitalInOut(board.SD_CS)
    sdcard = adafruit_sdcard.SDCard(spi, cs)
    vfs = storage.VfsFat(sdcard)
    storage.mount(vfs, "/sd")

    WHITE = 0xFFFFFF
    BLACK = 0x000000
    RED = 0xFF0000
    ORANGE = 0xFFA500
    YELLOW = 0xFFFF00
    GREEN = 0x00FF00
    BLUE = 0x0000FF
    PURPLE = 0x800080
    PINK = 0xFFC0CB

    colors = (BLACK, RED, ORANGE, YELLOW, GREEN, BLUE, PURPLE, WHITE)

    print('Building sample bitmap and palette')
    bitmap = Bitmap(16, 16, 9)
    palette = Palette(len(colors))
    for i, c in enumerate(colors):
        palette[i] = c

    for x in range(16):
        for y in range(16):
            if x == 0 or y == 0 or x == 15 or y == 15:
                bitmap[x, y] = 1
            elif x == y:
                bitmap[x, y] = 4
            elif x == 15 - y:
                bitmap[x, y] = 5
            else:
                bitmap[x, y] = 0

    print('Saving bitmap')
    save_pixels('/sd/test.bmp', bitmap, palette)

Documentation
=============

API documentation for this library can be found on `Read the Docs <https://docs.circuitpython.org/projects/bitmapsaver/en/latest/>`_.

For information on building library documentation, please check out `this guide <https://learn.adafruit.com/creating-and-sharing-a-circuitpython-library/sharing-our-docs-on-readthedocs#sphinx-5-1>`_.

Contributing
============

Contributions are welcome! Please read our `Code of Conduct
<https://github.com/adafruit/Adafruit_CircuitPython_BitmapSaver/blob/main/CODE_OF_CONDUCT.md>`_
before contributing to help this project stay welcoming.

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "adafruit-circuitpython-bitmapsaver",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "adafruit,blinka,circuitpython,micropython,bitmapsaver,displayio",
    "author": "",
    "author_email": "Adafruit Industries <circuitpython@adafruit.com>",
    "download_url": "https://files.pythonhosted.org/packages/9d/15/1e9e271b5e3d801fff80b9157753b7d8988dacaf0558d32c122c1d2ebe2d/adafruit-circuitpython-bitmapsaver-1.3.0.tar.gz",
    "platform": null,
    "description": "Introduction\n============\n\n.. image:: https://readthedocs.org/projects/adafruit-circuitpython-bitmapsaver/badge/?version=latest\n    :target: https://docs.circuitpython.org/projects/bitmapsaver/en/latest/\n    :alt: Documentation Status\n\n.. image:: https://raw.githubusercontent.com/adafruit/Adafruit_CircuitPython_Bundle/main/badges/adafruit_discord.svg\n    :target: https://adafru.it/discord\n    :alt: Discord\n\n.. image:: https://github.com/adafruit/Adafruit_CircuitPython_BitmapSaver/workflows/Build%20CI/badge.svg\n    :target: https://github.com/adafruit/Adafruit_CircuitPython_BitmapSaver/actions/\n    :alt: Build Status\n\n.. image:: https://img.shields.io/badge/code%20style-black-000000.svg\n    :target: https://github.com/psf/black\n    :alt: Code Style: Black\n\nSave a displayio.Bitmap (and associated displayio.Palette) into a BMP file.\n\n\nDependencies\n=============\nThis driver depends on:\n\n* `Adafruit CircuitPython <https://github.com/adafruit/circuitpython>`_\n\nCircuitPython 5.0 or later is required.\n\nPlease ensure all dependencies are available on the CircuitPython filesystem.\nThis is easily achieved by downloading\n`the Adafruit library and driver bundle <https://github.com/adafruit/Adafruit_CircuitPython_Bundle>`_.\n\nInstalling from PyPI\n=====================\n.. note:: This library is not available on PyPI yet. Install documentation is included\n   as a standard element. Stay tuned for PyPI availability!\n\nOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally `from\nPyPI <https://pypi.org/project/adafruit-circuitpython-bitmapsaver/>`_. To install for current user:\n\n.. code-block:: shell\n\n    pip3 install adafruit-circuitpython-bitmapsaver\n\nTo install system-wide (this may be required in some cases):\n\n.. code-block:: shell\n\n    sudo pip3 install adafruit-circuitpython-bitmapsaver\n\nTo install in a virtual environment in your current project:\n\n.. code-block:: shell\n\n    mkdir project-name && cd project-name\n    python3 -m venv .venv\n    source .venv/bin/activate\n    pip3 install adafruit-circuitpython-bitmapsaver\n\nUsage Example\n=============\n\n.. code-block:: python\n\n    import board\n    import busio\n    import digitalio\n    from displayio import Bitmap, Palette\n    import adafruit_sdcard\n    import storage\n    from adafruit_bitmapsaver import save_pixels\n\n    print('Setting up SD card')\n    spi = busio.SPI(board.SCK, MOSI=board.MOSI, MISO=board.MISO)\n    cs = digitalio.DigitalInOut(board.SD_CS)\n    sdcard = adafruit_sdcard.SDCard(spi, cs)\n    vfs = storage.VfsFat(sdcard)\n    storage.mount(vfs, \"/sd\")\n\n    WHITE = 0xFFFFFF\n    BLACK = 0x000000\n    RED = 0xFF0000\n    ORANGE = 0xFFA500\n    YELLOW = 0xFFFF00\n    GREEN = 0x00FF00\n    BLUE = 0x0000FF\n    PURPLE = 0x800080\n    PINK = 0xFFC0CB\n\n    colors = (BLACK, RED, ORANGE, YELLOW, GREEN, BLUE, PURPLE, WHITE)\n\n    print('Building sample bitmap and palette')\n    bitmap = Bitmap(16, 16, 9)\n    palette = Palette(len(colors))\n    for i, c in enumerate(colors):\n        palette[i] = c\n\n    for x in range(16):\n        for y in range(16):\n            if x == 0 or y == 0 or x == 15 or y == 15:\n                bitmap[x, y] = 1\n            elif x == y:\n                bitmap[x, y] = 4\n            elif x == 15 - y:\n                bitmap[x, y] = 5\n            else:\n                bitmap[x, y] = 0\n\n    print('Saving bitmap')\n    save_pixels('/sd/test.bmp', bitmap, palette)\n\nDocumentation\n=============\n\nAPI documentation for this library can be found on `Read the Docs <https://docs.circuitpython.org/projects/bitmapsaver/en/latest/>`_.\n\nFor information on building library documentation, please check out `this guide <https://learn.adafruit.com/creating-and-sharing-a-circuitpython-library/sharing-our-docs-on-readthedocs#sphinx-5-1>`_.\n\nContributing\n============\n\nContributions are welcome! Please read our `Code of Conduct\n<https://github.com/adafruit/Adafruit_CircuitPython_BitmapSaver/blob/main/CODE_OF_CONDUCT.md>`_\nbefore contributing to help this project stay welcoming.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Save a displayio.Bitmap (and associated displayio.Palette) into a BMP file.",
    "version": "1.3.0",
    "project_urls": {
        "Homepage": "https://github.com/adafruit/Adafruit_CircuitPython_BitmapSaver"
    },
    "split_keywords": [
        "adafruit",
        "blinka",
        "circuitpython",
        "micropython",
        "bitmapsaver",
        "displayio"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f1a6572dbceafab1d016da2a4b1c81c763dd8a9d29edd1610cbd980aeb2eb241",
                "md5": "f9edaa1b0efecbde077970a0695433a3",
                "sha256": "496d02f5af217b631f983e556a4db240a9524074246a7771d66b530483e3e338"
            },
            "downloads": -1,
            "filename": "adafruit_circuitpython_bitmapsaver-1.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f9edaa1b0efecbde077970a0695433a3",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 6193,
            "upload_time": "2024-02-22T23:02:48",
            "upload_time_iso_8601": "2024-02-22T23:02:48.706332Z",
            "url": "https://files.pythonhosted.org/packages/f1/a6/572dbceafab1d016da2a4b1c81c763dd8a9d29edd1610cbd980aeb2eb241/adafruit_circuitpython_bitmapsaver-1.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9d151e9e271b5e3d801fff80b9157753b7d8988dacaf0558d32c122c1d2ebe2d",
                "md5": "8fc7f39717c19ffc8639a1e6400859a2",
                "sha256": "54b5411dc6424b5683a79d9bdbd5b42d5f1b1ac55eec7754a6118958dec2e0ff"
            },
            "downloads": -1,
            "filename": "adafruit-circuitpython-bitmapsaver-1.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "8fc7f39717c19ffc8639a1e6400859a2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 126898,
            "upload_time": "2024-02-22T23:02:50",
            "upload_time_iso_8601": "2024-02-22T23:02:50.533708Z",
            "url": "https://files.pythonhosted.org/packages/9d/15/1e9e271b5e3d801fff80b9157753b7d8988dacaf0558d32c122c1d2ebe2d/adafruit-circuitpython-bitmapsaver-1.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-22 23:02:50",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "adafruit",
    "github_project": "Adafruit_CircuitPython_BitmapSaver",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "Adafruit-Blinka",
            "specs": []
        }
    ],
    "lcname": "adafruit-circuitpython-bitmapsaver"
}
        
Elapsed time: 0.18808s