talira

Single-file public domain libraries for C and C++

open sourceMIT OR Unlicensefree

stb is Sean Barrett's collection of single-file libraries for C and C++: you drop one header into your project and use it, with nothing to build or link. The best known are stb_image (loading JPG, PNG, TGA, BMP, PSD, GIF and HDR images from files or memory), stb_image_write, stb_truetype (parsing and rasterizing TrueType fonts) and stb_ds (typesafe dynamic arrays and hash tables for C); others decode Ogg Vorbis audio, pack rectangles, generate Perlin noise, render voxels and help write C-like parsers. Each is public domain, and most are also MIT licensed.

Problems it solves

  • load a PNG or JPG in my C program without pulling in libpng
  • render TrueType text in a game without a big font library
  • a header-only hash table and dynamic array for plain C

Features

  • single-header libraries with nothing to build or link
  • image loading and writing (JPG, PNG, TGA, BMP, PSD, GIF, HDR)
  • TrueType font rasterizing
  • typesafe dynamic arrays and hash tables for C
  • Ogg Vorbis decoding
  • rectangle packing, Perlin noise and voxel rendering

Limitations

  • Security bugs are discussed in public issues and fixes may take a long time to land; its README advises against using it where that's an unreasonable risk1