Introduction
libstb (Shaped Typography & Bitmaps) decodes, encodes, resizes, edits and draws images, renders text (Persian and Arabic included) and compresses with zlib, from Python and from C++. It has no system libraries and no Python dependencies.
The code on every page follows the language you pick in the top bar. Your choice is remembered, and ?lang=cpp or ?lang=python in a link preselects it. Where the two APIs differ, the page says so in text, and its last section, "API at a glance", lists the calls of the language you picked.
Where to start
- Install the Python package or add the C++ library to a CMake project.
- The quick start opens a picture, makes a thumbnail and writes it.
- Then pick a chapter:
- Image: open and inspect, encode and write, resize, the Resizer, crop, flip, rotate and pad, channels and alpha, EXIF orientation, premultiplied alpha and untrusted input.
- Font: render text, Persian and Arabic, glyphs and shaping, finding fonts, variable fonts, text size without a font and subsetting.
- Canvas: canvas basics, shapes and colors, blending and masks and vector outlines and matrices and bounds.
- Processing: filters, convolution and gradients, the guided filter, tone, look-up tables, color spaces, threshold, morphology, warp, connected components, superpixels and metrics.
- zlib: compress and decompress.
- Runtime: SIMD and threads and logging.
- Interop (Python): NumPy, Pillow and DLPack.
- Benchmarks: how libstb compares with Pillow, OpenCV, imageio and scikit-image.
What is not here
The Doxygen (C++) and Sphinx (Python) references are not part of this site, and a few corners (the rarer Outline and Loader options) are described in the guide and in the project README rather than on a page of their own.