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:
- image
Image Input image in any Pillow mode; converted to RGB internally.
- fmt
str, 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 examplecompress_levelfor PNG.
- image
- Returns:
floatNegative encoded size in bits per pixel. Always negative; values closer to 0 indicate a more compressible image. The value depends on
fmtandsave_kwargs, so only compare images analysed with the same settings.