Released on 2026-06-10.
Highlights
flags2rgb visualizes per-instance boolean flags as pie glyphs with a legend, where wedge color (and optionally angle) encodes flag identity:
import imgviz
viz = imgviz.flags2rgb(
image=image, # (H, W, 3) uint8
flags=flags, # (N, F) bool
centers=centers, # (N, 2) [(cy, cx), ...]
flag_names=["occluded", "grasped", "verified"],
)This release also adds the polygon, pie, and letterbox drawing primitives; diff for image-difference visualization (signed/abs/ssim modes); and blur/pixelate with optional masking for redaction.
Behavior changes
- Shape primitives (
circle_,ellipse_,rectangle_,star_,triangle_) now raise when called with neitherfillnoroutline, instead of silently returning the image unchanged (#123). asrgb(rgba, copy=True)now returns an independent array for RGBA input; it previously returned a view, which could let in-place callers overwrite the source (#172).
New Features
flags2rgbcomposition (#170)difffor image difference visualization with signed/abs/ssim modes (#144)blurandpixelate(with optional mask for redaction) (#138)letterboxprimitive (#139)piedrawing primitive (#146)polygondrawing primitive (#121)- Directional multi-channel
imgviz.pad(#167)
Bug fixes
label2rgbcrash on all--1input: no longer raisesIndexErrorwhen the label contains only unlabeled (-1) pixels. (#122)imreadfile-handle leak: the file handle is now closed after reading. (#124)normalizemin/max collapse after float32 cast: min and max are kept distinct after casting to float32. (#143)Nchannel2Rgbcache comparison: avoids an ambiguous array comparison in theNchannel2Rgbcache. (#169)text_in_rectangleleft alignment:lb/lb-text now aligns to the rectangle's left edge. (#175)flow2rgbcolor-wheel overflow: prevents an out-of-bounds color-wheel index. (#173)
Internal
- Extract corner legend into
imgviz.components.legend(#168) - Publish to PyPI on GitHub release instead of tag push (#182)
- Docs: rework diff example, record the visualization-construction architecture, dissolve ROADMAP.md into ADRs, and tidy README banners and image paths (#145, #147, #165, #177, #180)
- Tests: expand coverage for
instances2rgb,resize, andtile(#166, #171, #174) - Dependencies: add
mdformat-gfm, bumpurllib3andidna, and align make targets (#140, #141, #120, #125)
Install
pip install -U imgviz==2.1.0
# or
uv pip install imgviz==2.1.0Full changelog: v2.0.1...v2.1.0