Skip to content

Instantly share code, notes, and snippets.

@nothings
Last active August 19, 2023 08:38
Show Gist options
  • Star 16 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nothings/e17b15167a4b4ecc7a68 to your computer and use it in GitHub Desktop.
Save nothings/e17b15167a4b4ecc7a68 to your computer and use it in GitHub Desktop.

Are there other single-file public-domain libraries out there?

Yes. Here are some:

  • jo_gif.cpp: tiny GIF writer (public domain)
  • gif.h: animated GIF writer (public domain)
  • tiny_jpeg.h: JPEG encoder (public domain)
  • lodepng: PNG encoder/decoder (zlib license)
  • nanoSVG: 1-file SVG parser; 1-file SVG rasterizer (zlib license)
  • tinyobjloader: wavefront OBJ file loader (BSD license)
  • sdf.h: compute signed-distance field from antialiased image (MIT license)
  • nv_voronoi.h: find voronoi regions on lattice w/ integer inputs (public domain)
  • nanoflann: build KD trees for point clouds (BSD license)
  • DG_misc.h: Daniel Gibson's stb.h-esque cross-platform helpers: path/file, strings (public domain)
  • MakeID.h: allocate/deallocate small integer IDs efficiently (public domain)
  • utest: unit testing (MIT license)

There are some that have a source file and require a separate header file (which they may not even supply). That's twice as many files, and we at nothings/stb cannot condone this! But you might like them anyway:

  • picopng.cpp: tiny PNG loader (zlib license)
  • jpeg-compressor: 2-file jpeg compress, 2-file jpeg decompress (public domain)
  • tinyexr: EXR image read/write, uses miniz internally (BSD license)
  • miniz.c: zlib compression,decompression, zip file, png writing (public domain)
  • Remotery: CPU/GPU profiler Win/Mac/Linux, using web browser for viewer (Apache 2.0 license)
  • Clipper: line & polygon clipping & offsetting (Boost license)
  • json.h: JSON parser (public domain)
  • Zange: another JSON parser (MIT license)

There is also this XML library, but if you're using XML, shame on you:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment