Install & Compatibility
Where this runs
tested against v1.2.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
py 3.10
✕ build_error
✓ 2.6s
py 3.11
✕ build_error
✓ 2.4s
py 3.12
✕ build_error
✓ 2.2s
py 3.13
✕ build_error
✕ build_error
39MB installed
● package 39MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
encode
✓ from blurhash import encode
Official import path from the package.
decode
✓ from blurhash import decode
Official import path for decoding.
Encode an image to a BlurHash string and decode it back to a rough placeholder.
from blurhash import encode, decode
from PIL import Image
import numpy as np
img = Image.open('image.jpg').convert('RGB')
arr = np.array(img)
blurhash_str = encode(1920, 1080, arr)
print(blurhash_str)
# Decode back to pixels
pixels = decode(blurhash_str, 32, 32)
recreated = Image.fromarray(pixels.astype('uint8'), 'RGB')
recreated.show()
Errors
Common errors & fixes
TypeError: Argument 'pixels' must be a numpy array with dtype uint8 and shape (height, width, 3)
Passing non-numpy data or incorrect dtype/shape to encode().
fixEnsure pixels is a numpy array: np.array(Image.open('img.jpg')).astype('uint8') and check shape. ValueError: Invalid BlurHash: ...
Trying to decode an invalid or corrupted BlurHash string.
fixVerify the BlurHash string has the correct format (e.g., ~LGFO.?-RM{WB?ofV@WB?ofWBof) and was generated by a compatible encoder. Upgrade
Version history
1.2.2latest on PyPI · released Jan 24, 2024
Audit
Dependencies
No dependency data recorded yet.