visfeats.compressibility_pillow#

visfeats.compressibility_pillow(image: Image, *, fmt: str = 'PNG', **save_kwargs) → float#

Estimate the compressibility of an image from its encoded size.

The image is converted to RGB and encoded in memory with Pillow (no file is written). Compressibility is the negative of the encoded size in bits per pixel, so more compressible (simpler) images get higher values.

Parameters:
imageImage

Input image in any Pillow mode; converted to RGB internally.

fmtstr, default=”PNG”

Pillow format used for encoding. Use a lossless format (such as "PNG") so the size reflects image redundancy rather than a quality setting.

**save_kwargs

Additional keyword arguments passed to Image.save, for example compress_level for PNG.

Returns:
float

Negative encoded size in bits per pixel. Always negative; values closer to 0 indicate a more compressible image. The value depends on fmt and save_kwargs, so only compare images analysed with the same settings.