Skip to main content

pybmp

BMP image handler for Python (to numpy ndarray or PIL) native C .pyd

How to use

from pybmp import bmp
import numpy as np
import matplotlib.pyplot as plt
# import matplotlib.image as mpimg
from scipy import misc
from PIL import Image

fig = plt.figure()
axis = [fig.add_subplot(211 + _) for _ in range(2)]
img = Image.open('../res/cs_checker_7x5_24.bmp') # R,G,B
# fake convert to ubytes img:R,G,B -> s:R,G,B,FF -> im:B,G,R,A -> bm:B,G,R,A
nda = np.array(img)
r, c, m = nda.shape
s = img.tostring('raw', 'RGBX') # append A as FF
im = Image.fromstring('RGBA', (c, r), s, 'raw', 'BGRA') # fake to B,G,R,A
bm = np.array(im) # fake to B,G,R,A
axis[0].imshow(nda)
bmp.BMP(bm, fn='/tmp/cs_checker_out_.bmp')
# plt.show()

License

MIT License

Metadata

Release files for pybmp 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pybmp 1.0.1
File Size Uploaded
pybmp-1.0.1.tar.gz 9.3 kB Details

Release files / pybmp-1.0.1.tar.gz

Download URL pybmp-1.0.1.tar.gz
Size 9.3 kB
Tags Source
SHA-256 checksum
How to use checksums
4b64d3513b72ab221c5b43dd57a073304b17a0ed2833c62c8a8c735ea43e3779
BLAKE2b-256 checksum
How to use checksums
9c22f80f65d5238a0e8c894a36b43ba77a3e68667450d8329592b15c42bf02ea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

1.0.1 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page