{"id":13400268,"url":"https://github.com/nothings/stb","last_synced_at":"2025-05-12T05:32:53.623Z","repository":{"id":17387689,"uuid":"20159867","full_name":"nothings/stb","owner":"nothings","description":"stb single-file public domain libraries for C/C++","archived":false,"fork":false,"pushed_at":"2025-03-14T18:32:23.000Z","size":5771,"stargazers_count":28746,"open_issues_count":336,"forks_count":7823,"subscribers_count":629,"default_branch":"master","last_synced_at":"2025-05-12T02:49:29.737Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://twitter.com/nothings","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nothings.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2014-05-25T16:51:23.000Z","updated_at":"2025-05-12T00:25:10.000Z","dependencies_parsed_at":"2023-01-14T12:46:59.201Z","dependency_job_id":"c15b0211-1a6b-490f-8145-ae9e369deab9","html_url":"https://github.com/nothings/stb","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nothings%2Fstb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nothings%2Fstb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nothings%2Fstb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nothings%2Fstb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nothings","download_url":"https://codeload.github.com/nothings/stb/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253672735,"owners_count":21945482,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-30T19:00:50.116Z","updated_at":"2025-05-12T05:32:53.591Z","avatar_url":"https://github.com/nothings.png","language":"C","readme":"\u003c!---   THIS FILE IS AUTOMATICALLY GENERATED, DO NOT CHANGE IT BY HAND   ---\u003e\n\nstb\n===\n\nsingle-file public domain (or MIT licensed) libraries for C/C++\n\n# This project discusses security-relevant bugs in public in Github Issues and Pull Requests, and it may take significant time for security fixes to be implemented or merged. If this poses an unreasonable risk to your project, do not use stb libraries.\n\nNoteworthy:\n\n* image loader: [stb_image.h](stb_image.h)\n* image writer: [stb_image_write.h](stb_image_write.h)\n* image resizer: [stb_image_resize2.h](stb_image_resize2.h)\n* font text rasterizer: [stb_truetype.h](stb_truetype.h)\n* typesafe containers: [stb_ds.h](stb_ds.h)\n\nMost libraries by stb, except: stb_dxt by Fabian \"ryg\" Giesen, original stb_image_resize\nby Jorge L. \"VinoBS\" Rodriguez, and stb_image_resize2 and stb_sprintf by Jeff Roberts.\n\n\u003ca name=\"stb_libs\"\u003e\u003c/a\u003e\n\nlibrary    | lastest version | category | LoC | description\n--------------------- | ---- | -------- | --- | --------------------------------\n**[stb_vorbis.c](stb_vorbis.c)** | 1.22 | audio | 5584 | decode ogg vorbis files from file/memory to float/16-bit signed output\n**[stb_hexwave.h](stb_hexwave.h)** | 0.5 | audio | 680 | audio waveform synthesizer\n**[stb_image.h](stb_image.h)** | 2.30 | graphics | 7988 | image loading/decoding from file/memory: JPG, PNG, TGA, BMP, PSD, GIF, HDR, PIC\n**[stb_truetype.h](stb_truetype.h)** | 1.26 | graphics | 5079 | parse, decode, and rasterize characters from truetype fonts\n**[stb_image_write.h](stb_image_write.h)** | 1.16 | graphics | 1724 | image writing to disk: PNG, TGA, BMP\n**[stb_image_resize2.h](stb_image_resize2.h)** | 2.13 | graphics | 10616 | resize images larger/smaller with good quality\n**[stb_rect_pack.h](stb_rect_pack.h)** | 1.01 | graphics | 623 | simple 2D rectangle packer with decent quality\n**[stb_perlin.h](stb_perlin.h)** | 0.5 | graphics | 428 | perlin's revised simplex noise w/ different seeds\n**[stb_ds.h](stb_ds.h)** | 0.67 | utility | 1895 | typesafe dynamic array and hash tables for C, will compile in C++\n**[stb_sprintf.h](stb_sprintf.h)** | 1.10 | utility | 1906 | fast sprintf, snprintf for C/C++\n**[stb_textedit.h](stb_textedit.h)** | 1.14 | user\u0026nbsp;interface | 1429 | guts of a text editor for games etc implementing them from scratch\n**[stb_voxel_render.h](stb_voxel_render.h)** | 0.89 | 3D\u0026nbsp;graphics | 3807 | Minecraft-esque voxel rendering \"engine\" with many more features\n**[stb_dxt.h](stb_dxt.h)** | 1.12 | 3D\u0026nbsp;graphics | 719 | Fabian \"ryg\" Giesen's real-time DXT compressor\n**[stb_easy_font.h](stb_easy_font.h)** | 1.1 | 3D\u0026nbsp;graphics | 305 | quick-and-dirty easy-to-deploy bitmap font for printing frame rate, etc\n**[stb_tilemap_editor.h](stb_tilemap_editor.h)** | 0.42 | game\u0026nbsp;dev | 4187 | embeddable tilemap editor\n**[stb_herringbone_wa...](stb_herringbone_wang_tile.h)** | 0.7 | game\u0026nbsp;dev | 1221 | herringbone Wang tile map generator\n**[stb_c_lexer.h](stb_c_lexer.h)** | 0.12 | parsing | 941 | simplify writing parsers for C-like languages\n**[stb_divide.h](stb_divide.h)** | 0.94 | math | 433 | more useful 32-bit modulus e.g. \"euclidean divide\"\n**[stb_connected_comp...](stb_connected_components.h)** | 0.96 | misc | 1049 | incrementally compute reachability on grids\n**[stb_leakcheck.h](stb_leakcheck.h)** | 0.6 | misc | 194 | quick-and-dirty malloc/free leak-checking\n**[stb_include.h](stb_include.h)** | 0.02 | misc | 295 | implement recursive #include support, particularly for GLSL\n\nTotal libraries: 21\nTotal lines of C code: 51103\n\n\nFAQ\n---\n\n#### What's the license?\n\nThese libraries are in the public domain. You can do anything you\nwant with them. You have no legal obligation\nto do anything else, although I appreciate attribution.\n\nThey are also licensed under the MIT open source license, if you have lawyers\nwho are unhappy with public domain. Every source file includes an explicit\ndual-license for you to choose from.\n\n#### How do I use these libraries?\n\nThe idea behind single-header file libraries is that they're easy to distribute and deploy\nbecause all the code is contained in a single file. By default, the .h files in here act as\ntheir own header files, i.e. they declare the functions contained in the file but don't\nactually result in any code getting compiled.\n\nSo in addition, you should select _exactly one_ C/C++ source file that actually instantiates\nthe code, preferably a file you're not editing frequently. This file should define a\nspecific macro (this is documented per-library) to actually enable the function definitions.\nFor example, to use stb_image, you should have exactly one C/C++ file that doesn't\ninclude stb_image.h regularly, but instead does\n\n    #define STB_IMAGE_IMPLEMENTATION\n    #include \"stb_image.h\"\n\nThe right macro to define is pointed out right at the top of each of these libraries.\n\n#### \u003ca name=\"other_libs\"\u003e\u003c/a\u003e Are there other single-file public-domain/open source libraries with minimal dependencies out there?\n\n[Yes.](https://github.com/nothings/single_file_libs)\n\n#### If I wrap an stb library in a new library, does the new library have to be public domain/MIT?\n\nNo, because it's public domain you can freely relicense it to whatever license your new\nlibrary wants to be.\n\n#### What's the deal with SSE support in GCC-based compilers?\n\nstb_image will either use SSE2 (if you compile with -msse2) or\nwill not use any SIMD at all, rather than trying to detect the\nprocessor at runtime and handle it correctly. As I understand it,\nthe approved path in GCC for runtime-detection require\nyou to use multiple source files, one for each CPU configuration.\nBecause stb_image is a header-file library that compiles in only\none source file, there's no approved way to build both an\nSSE-enabled and a non-SSE-enabled variation.\n\nWhile we've tried to work around it, we've had multiple issues over\nthe years due to specific versions of gcc breaking what we're doing,\nso we've given up on it. See https://github.com/nothings/stb/issues/280\nand https://github.com/nothings/stb/issues/410 for examples.\n\n#### Some of these libraries seem redundant to existing open source libraries. Are they better somehow?\n\nGenerally they're only better in that they're easier to integrate,\neasier to use, and easier to release (single file; good API; no\nattribution requirement). They may be less featureful, slower,\nand/or use more memory. If you're already using an equivalent\nlibrary, there's probably no good reason to switch.\n\n#### Can I link directly to the table of stb libraries?\n\nYou can use [this URL](https://github.com/nothings/stb#stb_libs) to link directly to that list.\n\n#### Why do you list \"lines of code\"? It's a terrible metric.\n\nJust to give you some idea of the internal complexity of the library,\nto help you manage your expectations, or to let you know what you're\ngetting into. While not all the libraries are written in the same\nstyle, they're certainly similar styles, and so comparisons between\nthe libraries are probably still meaningful.\n\nNote though that the lines do include both the implementation, the\npart that corresponds to a header file, and the documentation.\n\n#### Why single-file headers?\n\nWindows doesn't have standard directories where libraries\nlive. That makes deploying libraries in Windows a lot more\npainful than open source developers on Unix-derivates generally\nrealize. (It also makes library dependencies a lot worse in Windows.)\n\nThere's also a common problem in Windows where a library was built\nagainst a different version of the runtime library, which causes\nlink conflicts and confusion. Shipping the libs as headers means\nyou normally just compile them straight into your project without\nmaking libraries, thus sidestepping that problem.\n\nMaking them a single file makes it very easy to just\ndrop them into a project that needs them. (Of course you can\nstill put them in a proper shared library tree if you want.)\n\nWhy not two files, one a header and one an implementation?\nThe difference between 10 files and 9 files is not a big deal,\nbut the difference between 2 files and 1 file is a big deal.\nYou don't need to zip or tar the files up, you don't have to\nremember to attach *two* files, etc.\n\n#### Why \"stb\"? Is this something to do with Set-Top Boxes?\n\nNo, they are just the initials for my name, Sean T. Barrett.\nThis was not chosen out of egomania, but as a moderately sane\nway of namespacing the filenames and source function names.\n\n#### Will you add more image types to stb_image.h?\n\nNo. As stb_image use has grown, it has become more important\nfor us to focus on security of the codebase. Adding new image\nformats increases the amount of code we need to secure, so it\nis no longer worth adding new formats.\n\n#### Do you have any advice on how to create my own single-file library?\n\nYes. https://github.com/nothings/stb/blob/master/docs/stb_howto.txt\n\n#### Why public domain?\n\nI prefer it over GPL, LGPL, BSD, zlib, etc. for many reasons.\nSome of them are listed here:\nhttps://github.com/nothings/stb/blob/master/docs/why_public_domain.md\n\n#### Why C?\n\nPrimarily, because I use C, not C++. But it does also make it easier\nfor other people to use them from other languages.\n\n#### Why not C99? stdint.h, declare-anywhere, etc.\n\nI still use MSVC 6 (1998) as my IDE because it has better human factors\nfor me than later versions of MSVC.\n","funding_links":[],"categories":["C","GPU computing","Miscellaneous","Utils","Source Code Collections","C/C++","Libraries","源代码集合","C/C++ 程序设计","排序","Libraries \u0026 Frameworks:","目录","Geometry, Graphics Processing, and Game Development","Frameworks ##","Graphics \u0026 Multimedia","Technologies \u0026 Libraries","package manager"],"sub_categories":["FPS","Advanced books","Libraries","高级书籍","网络服务_其他","多项混杂","Other","RTOS ###","C"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnothings%2Fstb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnothings%2Fstb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnothings%2Fstb/lists"}