{"id":18396928,"url":"https://github.com/monogame/monogame.tool.basisuniversal","last_synced_at":"2025-04-07T04:32:46.921Z","repository":{"id":244077611,"uuid":"814203416","full_name":"MonoGame/MonoGame.Tool.BasisUniversal","owner":"MonoGame","description":"MonoGame tooling build for basis_universal","archived":false,"fork":false,"pushed_at":"2024-08-22T07:52:32.000Z","size":22,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-06T03:39:50.812Z","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/MonoGame.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-12T14:34:14.000Z","updated_at":"2024-08-22T07:48:04.000Z","dependencies_parsed_at":"2024-06-12T20:40:49.813Z","dependency_job_id":"2076feeb-1682-4e88-95d0-773926424ad5","html_url":"https://github.com/MonoGame/MonoGame.Tool.BasisUniversal","commit_stats":null,"previous_names":["monogame/monogame.tool.basisuniversal"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MonoGame%2FMonoGame.Tool.BasisUniversal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MonoGame%2FMonoGame.Tool.BasisUniversal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MonoGame%2FMonoGame.Tool.BasisUniversal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MonoGame%2FMonoGame.Tool.BasisUniversal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MonoGame","download_url":"https://codeload.github.com/MonoGame/MonoGame.Tool.BasisUniversal/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247595101,"owners_count":20963939,"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-06T02:15:17.004Z","updated_at":"2025-04-07T04:32:46.682Z","avatar_url":"https://github.com/MonoGame.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MonoGame.Tool.BasisUniversal\nMonoGame tooling build for basis_universal\n\nThis tool can be used to compress an image into various texture compression\nformats. Examples are BC1-7, PVRTC, ETC1, ETC2, ASTC and ATC.\n\nTo use we must first create a \"basis\" file, this is an intermediate file containing\nthe image data. From this file ALL over texture formats can be created. It is probably\nworth caching this \"basis\" file between builds.\n\n```dotnetcli\nbasisu -file foo.png -ktx2\n```\n\nAdding a `-uastc` might give better results for some compression types.\n\nOnce you have the \"basis\" file you can then transform that into specific formats\nby using the `-unpack` command. Providing the `-format_only` flag will produce\nONLY that format. Omitting this flag will result in ALL supported formats being\nproduced.\nThe values for `-format_only` are the numerical values for the [transcoder_texture_format]( https://github.com/BinomialLLC/basis_universal/blob/ad9386a4a1cf2a248f7bbd45f543a7448db15267/transcoder/basisu_transcoder.h#L49). For example ATC with an Alpha channel maps to [cTFATC_RGBA](https://github.com/BinomialLLC/basis_universal/blob/ad9386a4a1cf2a248f7bbd45f543a7448db15267/transcoder/basisu_transcoder.h#L73C3-L73C14) which has a numerical value of `12`.\n\n```dotnetcli\nbasisu -unpack foo.ktx2 -ktx_only -linear -format_only 2\n```\n\nThe output file(s) are listed in the output. There may be many output files. They will be stored in a .ktx files, but the internal image data will be compressed. We can use libraries like `libktxsharp` to read the .ktx data.\n\n```csharp\nbyte[] ktxBytes = File.ReadAllBytes(\"myImage.ktx\");\n\nKtxStructure ktxStructure = null;\nusing (MemoryStream ms = new MemoryStream(ktxBytes))\n{\n\tktxStructure = KtxLoader.LoadInput(ms);\n}\n\nConsole.WriteLine(ktxStructure.header.pixelWidth);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmonogame%2Fmonogame.tool.basisuniversal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmonogame%2Fmonogame.tool.basisuniversal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmonogame%2Fmonogame.tool.basisuniversal/lists"}