{"id":16822323,"url":"https://github.com/mborgerson/textureatlas","last_synced_at":"2025-08-11T00:52:13.383Z","repository":{"id":14409089,"uuid":"17119884","full_name":"mborgerson/textureatlas","owner":"mborgerson","description":"A simple, cross-platform Python-based tool and C library for creating and using a texture atlas in your application or game. Distributed under the terms of the MIT license.","archived":false,"fork":false,"pushed_at":"2025-01-03T10:10:12.000Z","size":62,"stargazers_count":26,"open_issues_count":0,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-11T03:11:22.608Z","etag":null,"topics":["atlas","c","gamedev","python","tools"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"OpenShare/openshare","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mborgerson.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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-02-23T23:37:11.000Z","updated_at":"2025-01-11T20:30:31.000Z","dependencies_parsed_at":"2025-04-11T03:11:25.034Z","dependency_job_id":"f6a8a507-2dbb-4a05-928e-76762506539b","html_url":"https://github.com/mborgerson/textureatlas","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mborgerson/textureatlas","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mborgerson%2Ftextureatlas","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mborgerson%2Ftextureatlas/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mborgerson%2Ftextureatlas/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mborgerson%2Ftextureatlas/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mborgerson","download_url":"https://codeload.github.com/mborgerson/textureatlas/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mborgerson%2Ftextureatlas/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269814274,"owners_count":24479358,"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","status":"online","status_checked_at":"2025-08-10T02:00:08.965Z","response_time":71,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["atlas","c","gamedev","python","tools"],"created_at":"2024-10-13T11:03:28.282Z","updated_at":"2025-08-11T00:52:13.320Z","avatar_url":"https://github.com/mborgerson.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"textureatlas\n============\n\nA simple, cross-platform tool and C library for creating and using a texture\natlas in your application or game. Distributed under the terms of the MIT\nlicense.\n\nWhat is a Texture Atlas?\n------------------------\n\n![](atlas.png)\n\nA **Texture Atlas** is a texture (raster image) composed of multiple smaller\ntextures. By loading a single large texture, you can reduce resource load time\nand improve performance by minimizing the number texture bind calls during\nrendering. A texture atlas is accompanied by a map file that identifies the\ncoordinates and dimensions of each texture in the atlas.\n\ntextureatlas\n---------------\n\n**textureatlas** is a Python-based command line tool that can be used to\ngenerate a texture atlas and accompanying map file from one or more images.\nImages can be grouped together as individual frames of the same texture (for\nanimated sequences, for instance). Each texture has a name that is used to\nidentify the texture in the atlas map file.\n\n### Map File\n\nThe **.map file** generated by textureatlas is a simple binary file or JSON file\nintended to be loaded with libtextureatlas from your application. The format of\nthe map file is documented in the source code.\n\n### Supported Image Formats \n\ntextureatlas uses the [Python Imaging\nLibrary](http://www.pythonware.com/products/pil/) to handle image manipulation,\nloading, and saving and hence supports many commonly used image file formats\nincluding **PNG, BMP, GIF, JPEG, and TGA**.\n\n### System Requirements\n\n* [Python 3.10+](http://www.python.org/)\n* [Pillow](http://pillow.readthedocs.org/en/latest/)\n\n### Usage\n\n    usage: __main__.py [-h] [-o output-image-filename] [-m output-map-filename] [-mf {binary,json}]\n                       [-im mode]\n                       texture [texture ...]\n\n    Packs many smaller images into one larger image, a Texture Atlas. A\n    companion file (.map), is created that defines where each texture is\n    mapped in the atlas.\n\n    positional arguments:\n      texture               filename of texture\n\n    options:\n      -h, --help            show this help message and exit\n      -o output-image-filename, --output-image-filename output-image-filename\n                            output image filename (atlas.png)\n      -m output-map-filename, --output-map-filename output-map-filename\n                            output map filename (atlas.map)\n      -mf {binary,json}, --map-format {binary,json}\n                            format of map output\n      -im mode, --image-mode mode\n                            output file mode (RGBA)\n\n\n#### Texture Parameter Format\n\nThe format of a **texture parameter** is as follows:\n\n    [\u003cname\u003e=]\u003cframe0.png\u003e\n    [\u003cname\u003e=]\"\u003cframe0.png\u003e \u003cframe1.png\u003e\"\n\nThe `\u003cname\u003e` of a texture is used to identify the texture in the texture atlas\nmap file. If you omit the `\u003cname\u003e` of the texture, the filename of the first\nframe, without the extension, will be used.\n\n##### Example 1\n\n    python -m textureatlas crate=texture1.png texture2.png\n\nThis example generate an atlas containing two textures, each of one frame,\nwith names 'crate' and 'texture2', respectively.\n\nYou may specify additional frames of a texture (e.g. for animated sequences) by\nenclosing the filenames of the frames in quotes.\n\n##### Example 2\n\n    python -m textureatlas \"texture_frame0.png texture_frame1.png\" texture2.png\n\nThis example generate an atlas containing two textures. The first texture,\nnamed 'texture_frame0', contains two frames. The second texture, named\n'texture2', contains only a single frame.\n\n##### Example 3\n\n    python -m textureatlas apple=picture_of_an_apple.png fire=\"fire0.png fire1.png\"\n\nThis example generate an atlas containing two textures. The first texture,\nnamed 'apple', contains only a single frame. The second texture, named\n'fire', contains two frames.\n\nUsing command-line tools, you can easily specify multiple frames for a texture\nfrom a directory listing.\n\n##### Example 4\n\n    python -m textureatlas fire=\"`ls sample/fire/*.png | xargs`\"\n\nThis example list all the .png files in the sample/fire directory as frames\nfor the 'fire' texture.\n\nlibtextureatlas\n---------------\n\n**libtextureatlas** is a small C library with a simple API for loading and\naccessing a binary texture atlas map file created by textureatlas. It has no\ndependencies on other libraries and can be easily integrated with your existing\nproject, especially if you are using [CMake](http://www.cmake.org/).\n\nPlease note that libtextureatlas will *not* load the image data of the texture,\njust the map file. There exist several good libraries for loading images; for\nloading and decompressing PNG images, you may be interested in\n[LodePNG](http://lodev.org/lodepng/).\n\n### Example Usage\n\n#### Loading a Texture Atlas Map File\n\n    texture_atlas_t *ta;\n    int result;\n\n    result = texture_atlas_load(\"atlas.map\", \u0026ta);\n    if (result) return 1;\n\n#### Looking Up a Texture by Name\n\n    texture_atlas_texture_t *texture;\n\n    texture = texture_atlas_lookup(ta, \"blaster\");\n    if (texture == NULL)\n    {\n        free(ta);\n        return 1;\n    }\n\n#### Stepping Through Texture Frames\n\n    texture_atlas_texture_t *texture;\n    texture_atlas_frame_t *frame;\n    unsigned int i;\n\n    for (i=0; i \u003c texture-\u003enum_frames; i++)\n    {\n        frame = texture-\u003eframes + i;\n        printf(\"Frame %d is at %d, %d.\\n\", i, frame-\u003ex, frame-\u003ey);\n    }\n\nLicense\n-------\n\nLicensed under the terms of the MIT license:\n\n    The MIT License (MIT)\n\n    Copyright (c) 2014-2025 Matt Borgerson\n\n    Permission is hereby granted, free of charge, to any person obtaining a copy\n    of this software and associated documentation files (the \"Software\"), to\n    deal in the Software without restriction, including without limitation the\n    rights to use, copy, modify, merge, publish, distribute, sublicense, and/or\n    sell copies of the Software, and to permit persons to whom the Software is\n    furnished to do so, subject to the following conditions:\n\n    The above copyright notice and this permission notice shall be included in\n    all copies or substantial portions of the Software.\n\n    THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n    FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n    IN THE SOFTWARE.\n\nResources\n---------\n\n* [nVidia Whitepaper](https://developer.nvidia.com/sites/default/files/akamai/tools/files/Texture_Atlas_Whitepaper.pdf) on\n  batching using texture atlases.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmborgerson%2Ftextureatlas","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmborgerson%2Ftextureatlas","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmborgerson%2Ftextureatlas/lists"}