{"id":17722797,"url":"https://github.com/bramp/binpack","last_synced_at":"2025-03-31T13:25:29.735Z","repository":{"id":223541656,"uuid":"760688496","full_name":"bramp/binpack","owner":"bramp","description":"Simple library for 2D bin packing, as used for texture atlases.","archived":false,"fork":false,"pushed_at":"2024-02-21T07:02:15.000Z","size":108,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-25T18:51:07.421Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bramp.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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},"funding":{"github":"bramp","buy_me_a_coffee":"bramp"}},"created_at":"2024-02-20T18:51:16.000Z","updated_at":"2024-12-08T15:17:13.000Z","dependencies_parsed_at":"2024-02-20T19:57:06.881Z","dependency_job_id":"d93e4344-e0bc-4ea4-90a4-f10212189744","html_url":"https://github.com/bramp/binpack","commit_stats":null,"previous_names":["bramp/binpack"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bramp%2Fbinpack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bramp%2Fbinpack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bramp%2Fbinpack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bramp%2Fbinpack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bramp","download_url":"https://codeload.github.com/bramp/binpack/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246473273,"owners_count":20783236,"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-10-25T15:39:24.439Z","updated_at":"2025-03-31T13:25:29.667Z","avatar_url":"https://github.com/bramp.png","language":"Dart","funding_links":["https://github.com/sponsors/bramp","https://buymeacoffee.com/bramp"],"categories":[],"sub_categories":[],"readme":"Simple library for 2D bin packing, as used for texture atlases.\n\n[![Pub package](https://img.shields.io/pub/v/binpack.svg)](https://pub.dev/packages/binpack)\n[![Pub publisher](https://img.shields.io/pub/publisher/binpack.svg)](https://pub.dev/publishers/bramp.net/packages)\n[![Dart Analysis](https://github.com/bramp/binpack/actions/workflows/dart.yml/badge.svg)](https://github.com/bramp/binpack/actions/workflows/dart.yml)\n\n## Features\n\nTakes a list of rectangles and packs them into a larger rectangle, with the goal\nof minimizing the larger rectangle's size.\n\nUses the algorithm described at https://github.com/TeamHypersomnia/rectpack2D\n\n## Usage\n\n```dart\nimport 'package:binpack/binpack.dart';\n\n// Create a list of key and rectanges.\n// The key can be anything specific to your application.\nfinal rects = [\n    ('image1.png', Rectangle(0, 0, 100, 200)), // Image 100x200 pixels\n    ('image2.png', Rectangle(0, 0, 32, 64)),\n    ('image3.png', Rectangle(0, 0, 128, 100)),\n    ('image4.png', Rectangle(0, 0, 300, 400)),\n];\n\n// Target the max size 4096 x 4096\nfinal results = Binpacker(4096, 4096).pack(rects);\n\n// The rectangles are now packed and their positions available:\nprint(results.placements);\n\n```\n\n## Example\n\nPacking 168 rects (from a game) into 4060x4065, with 95.7% efficiency.\n![Example Packed Image](https://github.com/bramp/binpack/blob/main/images/output.svg)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbramp%2Fbinpack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbramp%2Fbinpack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbramp%2Fbinpack/lists"}