Skip to main content

Benchmarks

libstb is measured against Pillow, OpenCV, imageio and scikit-image, one operation at a time: decoding, encoding, resizing, editing, drawing text and installing. Every chart in this chapter is drawn from one file, benchmarks/outputs/benchmark.json, which the benchmark suite writes; nothing here is typed by hand.

88 corpus entries · 7 repeats per cell · generated 2026-10-15 11:24 UTC

At a glance

Mean time of each library as a multiple of the reference, the library that was fastest on the most corpus entries (the reference column). 1.00× is the reference itself, and below 1 means less time than the reference. How the mean is taken, and why a mean of ratios needs care, is on the method page.

OperationReferencelibstblibstb (sRGB-correct)PillowOpenCVimageio
Decodelibstb1.00×–2.04×0.90×3.34×
Encode PNGlibstb1.00×–2.07×1.69×2.27×
Encode JPEGOpenCV1.00×–0.54×0.45×0.94×
Resize, half size, cubicOpenCV1.00×1.97×4.37×0.55×–
RGB to grayOpenCV1.00×–1.43×0.83×–

Where these numbers came from

Before anything was timed, every operation and library was run on small non-square images and its output checked (exact pixels for lossless formats, close for JPEG and resizing): 225 checks passed, 0 failed, 11 library/operation pairs unavailable (formats a library cannot handle at all).

CPUIntel(R) Xeon(R) Processor
Logical cores1
RAM3.9 GiB
Architecturex86_64
OSLinux 6.18.44-fc-v114
PythonCPython 3.12.3