features
Inspect the capabilities of the installed Blanket build without Pillow or external Python dependencies.
from blanket import features
print(features.check("heif_decoder"))
print(features.version("jxl"))
features.blanketinfo()
Feature names
Names are case-sensitive. get_supported() lists available canonical names.
| Name | Capability or version source |
|---|---|
blanket |
Installed Blanket version |
png |
PNG; Rust png crate version |
jpg (jpeg) |
JPEG; Rust turbojpeg wrapper version |
jxl (jpegxl) |
JPEG XL; linked libjxl version |
libtiff (tiff) |
TIFF; Rust tiff crate version |
webp |
WebP; linked libwebp version |
avif |
AVIF; Rust ravif encoder and dav1d decoder wrapper versions |
libheif |
Linked libheif version, independent of installed HEVC plugins |
heif (heic) |
HEIF/HEIC with both an HEVC decoder and encoder |
heif_decoder, heif_encoder |
Runtime HEVC plugin availability; linked libheif version |
bmp, ico |
BMP/ICO; Rust image crate version |
ppm (pgm, pbm, pnm), pam, tga, dds, qoi |
Extended raster formats; Rust image crate version; DDS reading only |
eps |
EPS reading; available when Ghostscript (gs) is on PATH; no backend version |
jpg_2000 (jpeg2000) |
JPEG 2000; built-in OpenJPEG version |
gif |
GIF; Rust gif crate version |
pdf |
PDF writing; no separate backend version |
littlecms2 |
LAB conversion; linked LittleCMS version |
libjpeg_turbo |
JPEG backend; Rust turbojpeg wrapper version |
Rust crate versions are labeled with the crate name and recorded at build time. They do not report the versions of any native libraries wrapped by those crates. Native library versions come from the libraries linked to the extension.
Pillow-specific features pil, tkinter, freetype2, zlib,
raqm, fribidi, harfbuzz, mozjpeg, zlib_ng, libimagequant, and xcb
are recognized as unavailable. Blanket's PNG implementation uses Rust
compression rather than the native zlib backend queried by Pillow.
Unknown names make check() warn and return False. version() returns
None for unknown, unavailable, or unversioned features.
blanketinfo() prints the package, Python, platform, backend, and single-image
format capabilities to stdout or a supplied text stream. Use
supported_formats=False to omit the format list. PDF supports saving only;
HEIF read/write availability is reported separately.
Reference
check
check(feature: str) -> bool
Check whether the installed build supports a feature.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
feature
|
str
|
A feature name, such as |
required |
Returns:
| Type | Description |
|---|---|
bool
|
Whether the feature is available. HEIF requires both an HEVC decoder |
bool
|
and encoder; query |
bool
|
for one direction. PDF availability means writing only. Unknown |
bool
|
names emit |
Examples:
>>> from blanket import features
>>> features.check("png")
True
version
version(feature: str) -> str | None
Return the installed backend's version, if available.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
feature
|
str
|
A name accepted by :func: |
required |
Returns:
| Type | Description |
|---|---|
str | None
|
A native library version for JXL, WebP, libheif, or LittleCMS; |
str | None
|
a labeled Rust backend crate version for the other codecs; or |
str | None
|
None for unavailable, unknown, or unversioned features. JPEG reports |
str | None
|
the turbojpeg Rust wrapper, not the underlying libjpeg-turbo version. |
Examples:
>>> from blanket import features
>>> features.version("blanket") is not None
True
get_supported
get_supported() -> list[str]
List the available canonical feature names.
Returns:
| Type | Description |
|---|---|
list[str]
|
Available feature names, without aliases. |
Examples:
>>> from blanket import features
>>> "png" in features.get_supported()
True
blanketinfo
blanketinfo(out: TextIO | None = None, supported_formats: bool = True) -> None
Print build, backend, and format diagnostics.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
out
|
TextIO | None
|
Text stream to receive the report. Defaults to current stdout. |
None
|
supported_formats
|
bool
|
Include format read/write capabilities. |
True
|
Examples:
>>> from io import StringIO
>>> from blanket import features
>>> report = StringIO()
>>> features.blanketinfo(report, supported_formats=False)
>>> "Blanket" in report.getvalue()
True