{"id":18823168,"url":"https://github.com/mobius3/chizu","last_synced_at":"2025-07-11T00:09:03.728Z","repository":{"id":34314952,"uuid":"38232481","full_name":"mobius3/chizu","owner":"mobius3","description":"A texture atlas generator library and tool","archived":false,"fork":false,"pushed_at":"2020-01-24T16:11:38.000Z","size":98,"stargazers_count":13,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-14T01:36:00.923Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mobius3.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-06-29T06:57:52.000Z","updated_at":"2024-03-26T15:54:50.000Z","dependencies_parsed_at":"2022-07-15T17:17:19.141Z","dependency_job_id":null,"html_url":"https://github.com/mobius3/chizu","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mobius3/chizu","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mobius3%2Fchizu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mobius3%2Fchizu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mobius3%2Fchizu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mobius3%2Fchizu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mobius3","download_url":"https://codeload.github.com/mobius3/chizu/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mobius3%2Fchizu/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264696460,"owners_count":23650936,"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-11-08T00:53:00.279Z","updated_at":"2025-07-11T00:09:03.533Z","avatar_url":"https://github.com/mobius3.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Chizu Texture Atlas Generator\n\nChizu is an atlas generator library and tool written in C99.\n\nThe library can be used to generate an atlas in runtime, while the tool can be used to pre-generate those atlas.\n\nWhen pre-generating, Chizu outputs a png and text file containing the sub-images and their location, respectively.\n\n## Dependencies\n\n - [SDL2](http://libsdl.org)\n - [SDL2\\_image](https://www.libsdl.org/projects/SDL_image/)\n - [CMake](http://cmake.org) to build\n\n## Build\n\n- Clone the repo.\n- Create a build folder inside.\n- Inside the build folder, run `cmake ..`\n- Run make (or mingw32-make depending on your platform)\n\nAn executable called `chizu` shoud be in the build folder, together with the library.\n\nIf you only want to build the library, you can pass `-DCHIZU_EXECUTABLE=OFF` in the\ncmake call.\n\n## Using the tool:\n\nThe chizu tool is a command-line executable to generate an atlas. It creates an image large enough to hold all the textures.\n\nThese are the arguments:\n\n    ./chizu \u003cbase-file-name\u003e \u003cimage1\u003e \u003cimage2\u003e [image3...]\n\nWhere\n\n- `\u003cbase-file-name\u003e` is the base name for the .txt and .png\n- `\u003cimageN\u003e` a list files to put in the atlas. At leas two must be provided.\n\nExample\n\n    ./chizu characters player.png enemies.png npcs.png\n\nWill generate a png called `characters.png` and a `characters.txt` file.\n\n## Using the library:\n\nChizu can be integrated with a project that uses CMake already simply by adding `add_subdirectory(chizu)` in your project, assuming that `chizu` is a subfolder of it containing Chizu code.\n\nAfterwards you can use `target_link_libraries(\u003ctarget\u003e chizu)` to link against the generated library.\n\nIf not using CMake, you can copy all the `.c` and `.h` files, except for `main.c`, and place in your project to compile it all together.\n\n## Text output format:\n\nThe text file will contain the information of which image is stored where inside the atlas, in the following format:\n\n    \u003cinput file\u003e \u003cx\u003e \u003cy\u003e \u003cwidth\u003e \u003cheight\u003e\n\nExample\n```\nplayer.png 0 0 128 128\nenemies.png 128 0 128 128\nnpcs.png 256 0 128 128\n```\n## Image format:\n\nThe generated image is usually 32 bits per pixel (with alpha channel), if the output format allows.\n\n## Example: generate and export an atlas.\n\n```cpp\n#include \"chizu.h\"\n\nint main() {\n   chizu_init();\n   chizu * atlas = chizu_create();\n\n   chizu_insert(atlas, \"player.png\"); \n   chizu_insert(atlas, \"enemies.png\"); \n   chizu_insert(atlas, \"npcs.png\");\n   chizu_export(atlas, \"characters.txt\", \"characters.png\", CHIZU_FORMAT_PNG);\n\n   chizu_destroy(atlas);\n   chizu_quit();\n   return 0;\n}\n```\n## Example: Generate and obtain atlas in runtime.\n\n```cpp\n#include \"chizu.h\"\n\nchizu_export_status custom_export(czexport * node, void * priv) {\n    printf(\"file %s is at %dx%d+%dx%d\\n\", node-\u003esubfile, node-\u003ex, node-\u003ey, node-\u003ew, node-\u003eh);\n    return CHIZU_EXPORT_OK;\n}\n\nvoid read_pixels(const void * pixels, unsigned w, unsigned h, unsigned d, void * priv) {\n    /* upload texture, convert pixels, whatever */\n}\n\nint main() {\n   chizu_init();\n   chizu * atlas = chizu_create();\n\n   chizu_insert(atlas, \"player.png\"); \n   chizu_insert(atlas, \"enemies.png\"); \n   chizu_insert(atlas, \"npcs.png\");\n\n   // custom_export is called for every subrect.\n   // the third parameter will be passed in each call to custom_export\n   chizu_custom_export(atlas, custom_export, NULL);\n\n   // read_pixels is called with the resulting pixel data so far\n   // the third parameter will be passed to read_pixels.\n   chizu_pixel_data(atlas, read_pixels, NULL);\n\n   chizu_destroy(atlas);\n   chizu_quit();\n   return 0;\n}\n```\n\nThese two examples should cover all the public functions in Chizu.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmobius3%2Fchizu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmobius3%2Fchizu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmobius3%2Fchizu/lists"}