{"id":16125544,"url":"https://github.com/semibran/pack","last_synced_at":"2025-03-16T09:31:53.711Z","repository":{"id":57317600,"uuid":"119345211","full_name":"semibran/pack","owner":"semibran","description":":package: greedy rectangle packing algorithm","archived":false,"fork":false,"pushed_at":"2023-08-29T06:31:03.000Z","size":347,"stargazers_count":37,"open_issues_count":5,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-20T12:44:46.427Z","etag":null,"topics":["bin-packing","combinatorial-optimization","rectangle-packing"],"latest_commit_sha":null,"homepage":"https://semibran.github.io/pack","language":"JavaScript","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/semibran.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":"2018-01-29T07:06:37.000Z","updated_at":"2024-05-11T23:47:51.000Z","dependencies_parsed_at":"2024-06-18T19:51:03.816Z","dependency_job_id":"459179c4-d9cb-4d1d-ab67-53c39fab28d5","html_url":"https://github.com/semibran/pack","commit_stats":{"total_commits":53,"total_committers":1,"mean_commits":53.0,"dds":0.0,"last_synced_commit":"6647608a2d2edccdd73af06fd1c5101cffbe8e09"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/semibran%2Fpack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/semibran%2Fpack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/semibran%2Fpack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/semibran%2Fpack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/semibran","download_url":"https://codeload.github.com/semibran/pack/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221377702,"owners_count":16808543,"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":["bin-packing","combinatorial-optimization","rectangle-packing"],"created_at":"2024-10-09T21:29:57.463Z","updated_at":"2024-10-27T10:17:10.858Z","avatar_url":"https://github.com/semibran.png","language":"JavaScript","readme":"# pack\n\u003e lightweight rectangle packer\n\n[View the demo!](https://semibran.github.io/pack)\n\n![boxes](img/boxes.png)\n\n`pack` is a [box packing algorithm](https://en.wikipedia.org/wiki/Bin_packing_problem) which attempts to determine the most compact configuration for a set of rectangles. To this end, it employs the first-fit decreasing (FFD) algorithm to place the boxes, using the length of the layout's shortest side length as a heuristic.\n\nUnlike traditional bin packing algorithms, the boxes here are placed in a single container that grows appropriately as they are packed inside. This property makes it ideal for assembling spritesheets given a list of images.\n\n## usage\n[![npm](https://nodei.co/npm/pack.png?mini)](https://www.npmjs.com/package/pack \"View npm package\")\n\n### `pack(sizes) -\u003e layout`\nArranges a list of `{ width, height }` pairs into the most compact `layout` possible. The result will be reminiscent of the following data structure:\n```js\nvar layout = {\n  width: 13,\n  height: 8,\n  rects: [\n    { x: 0, y: 0, width: 5, height: 3 },\n    { x: 0, y: 3, width: 6, height: 5 }\n    { x: 6, y: 0, width: 5, height: 4 },\n    { x: 11, y: 0, width: 2, height: 4 },\n    { x: 6, y: 4, width: 7, height: 4 },\n    { x: 5, y: 0, width: 1, height: 3 },\n  ]\n}\n```\n\n## kudos\n* [leo](https://github.com/leo) - for donating the package name\n\n## license\n[MIT](https://opensource.org/licenses/MIT) © [Brandon Semilla](https://git.io/semibran)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsemibran%2Fpack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsemibran%2Fpack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsemibran%2Fpack/lists"}