bitmap
raw JSON → 0.0.7 verified Mon Apr 27 auth: no python
A Python library for handling bitmap (BMP) files and bitmap graphics. Supports reading, writing, and manipulating bitmap images. Current version 0.0.7, released with no clear cadence.
pip install bitmap Common errors
error AttributeError: module 'bitmap' has no attribute 'Bitmap' ↓
cause Using 'import bitmap' then 'bitmap.Bitmap' without importing the class.
fix
Use 'from bitmap import Bitmap' instead.
error TypeError: __init__() missing 2 required positional arguments: 'x' and 'y' ↓
cause Calling Bitmap() without arguments.
fix
Provide width and height: Bitmap(100, 100).
Warnings
gotcha Bitmap constructor expects (width, height) but order is (x, y) meaning width then height. Common mistake: swapping arguments. ↓
fix Always use Bitmap(width, height).
gotcha Bitmap.clear() with no arguments sets all pixels to black. To set a color, pass an RGB tuple. ↓
fix Use bm.clear((r,g,b)) to set a color.
deprecated No official deprecation warnings observed; library is minimal with limited functionality. ↓
fix Consider using Pillow for advanced bitmap operations.
Imports
- Bitmap wrong
import bitmapcorrectfrom bitmap import Bitmap
Quickstart
from bitmap import Bitmap
# Create a 100x100 red bitmap
bm = Bitmap(100, 100)
bm.clear((255, 0, 0))
bm.save('red.bmp')
print('Saved red.bmp')