Repository navigation
v0.0.3
Blanket 0.0.3 adds drawing and text, image expressions, public color helpers, and runtime codec diagnostics. It also expands the Image API and improves native processing across image modes.
New features
- ImageDraw: Draw points, lines, rectangles, rounded rectangles, ellipses, arcs, chords, pieslices, and polygons. Includes optional antialiasing, translucent drawing on RGB images, bitmap drawing, and flood fill.
- Text drawing: Measure and draw single-line and multiline text with anchors, alignment, spacing, and strokes. A built-in bitmap font works without extra dependencies; compatible font objects, including explicitly supplied Pillow fonts, are also supported.
- ImageMath: Evaluate arithmetic, bitwise operations, comparisons, and conversions over single-band images with
lambda_eval()andunsafe_eval(). Pixel calculations run in Rust, with parallel execution for large images. - ImageColor: Use
getrgb()andgetcolor()to turn CSS color strings into RGB/RGBA tuples or mode-specific pixel values. - Runtime diagnostics: The new
featuresmodule providescheck(),version(),get_supported(), andblanketinfo()to inspect codec availability, backend versions, and HEIF encoder/decoder support. - More Image methods: Adds
show(),verify(),draft(),getim(),im,remap_palette(),tobitmap(), andeffect_spread().show()supports a custom viewer throughBLANKET_IMAGE_VIEWER.
Fixes and processing improvements
- Correct integer and floating-point conversions, including full-precision grayscale samples, 16-bit saturation and byte order, and independent output storage.
- Correct cropped scalar-image resizing and vertical reduction so intermediate results do not include unrelated rows or previous row sums.
- Improve neighborhood filtering across channels, large windows, image edges, and custom filter subclasses.
- Improve flood-fill coverage and drawing on independent images from multiple threads.
- Keep earlier winning PNG candidates during extended lossy-compression searches.
- Reduce metadata parsing allocations by skipping large pixel payloads in JPEG, PNG, and JPEG XL files.
- Expand portable SIMD kernels and parallel integer conversions; optimize packed-pixel operations, image math, resampling, filtering, and quantization.
Build and compatibility notes
- Source builds now require the nightly Rust toolchain pinned in
rust-toolchain.tomlfor portable SIMD. Native operations, codecs, and compression are split into focused workspace crates. - Update PyO3 to 0.30 and refresh native dependencies. Fix macOS linking by removing an unsupported linker flag.
- Drawing rasterization and the built-in font can differ from Pillow.
draft()is a compatibility no-op because decoding is eager;getim()andimexpose Blanket's native image object. ImageMath.unsafe_eval()and itseval()alias evaluate Python expressions and require trusted input. Preferlambda_eval()for callable expressions.
Installation
Requires Python 3.12+:
pip install --upgrade pyblanket==0.0.3Release assets include wheels for Linux x86_64 and ARM64 (glibc 2.39+), macOS 26+ on Apple Silicon, and a source distribution.
Full changelog: v0.0.2...v0.0.3