{"id":20226486,"url":"https://github.com/fiahfy/icns","last_synced_at":"2025-04-10T17:07:41.106Z","repository":{"id":33152799,"uuid":"151937440","full_name":"fiahfy/icns","owner":"fiahfy","description":"Apple Icon Image format parser and builder.","archived":false,"fork":false,"pushed_at":"2023-01-06T01:59:26.000Z","size":1233,"stargazers_count":13,"open_issues_count":12,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-25T14:21:35.203Z","etag":null,"topics":["builder","icns","parser"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/fiahfy.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":"2018-10-07T12:07:50.000Z","updated_at":"2024-03-05T08:47:52.000Z","dependencies_parsed_at":"2023-01-14T23:45:38.263Z","dependency_job_id":null,"html_url":"https://github.com/fiahfy/icns","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fiahfy%2Ficns","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fiahfy%2Ficns/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fiahfy%2Ficns/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fiahfy%2Ficns/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fiahfy","download_url":"https://codeload.github.com/fiahfy/icns/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224028292,"owners_count":17243693,"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":["builder","icns","parser"],"created_at":"2024-11-14T07:18:33.628Z","updated_at":"2024-11-14T07:18:34.120Z","avatar_url":"https://github.com/fiahfy.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!-- markdownlint-disable MD024 --\u003e\n\n# icns\n\n![badge](https://github.com/fiahfy/icns/workflows/Node.js%20Package/badge.svg)\n\n\u003e [Apple Icon Image format](https://en.wikipedia.org/wiki/Apple_Icon_Image_format) parser and builder.\n\n## Installation\n\n```bash\nnpm install @fiahfy/icns\n```\n\n## Usage\n\n### Parsing\n\n```js\nimport fs from 'fs'\nimport { Icns } from '@fiahfy/icns'\n\nconst buf = fs.readFileSync('icon.icns')\nconst icns = Icns.from(buf)\nconst imagesAsBuffers = icns.images.map((icon) =\u003e icon.image)\n```\n\nNote that the images may be encoded in different file formats, in accordance with [Apple's _icon type_ specifications](https://en.wikipedia.org/wiki/Apple_Icon_Image_format#Icon_types).\n\n### Building\n\n```js\nimport fs from 'fs'\nimport { Icns, IcnsImage } from '@fiahfy/icns'\n\nconst icns = new Icns()\nlet buf, image\n\nbuf = fs.readFileSync('512x512.png')\nimage = IcnsImage.fromPNG(buf, 'ic09')\nicns.append(image)\n\nbuf = fs.readFileSync('1024x1024.png')\nimage = IcnsImage.fromPNG(buf, 'ic10')\nicns.append(image)\n\n/* Some other PNG files */\n\nfs.writeFileSync('icon.icns', icns.data)\n```\n\n## API\n\n### Class: Icns\n\n#### static from(buffer)\n\nCreate ICNS from the icon buffer.\n\n##### buffer\n\nType: `Buffer`\n\nThe ICNS icon buffer.\n\n#### append(image)\n\nAdds ICNS image at the end.\n\n##### image\n\nType: `IcnsImage`\n\nThe ICNS Image to append.\n\n#### insert(image, index)\n\nInserts ICNS image at the specified position.\n\n##### image\n\nType: `IcnsImage`\n\nThe ICNS Image to insert.\n\n##### index\n\nType: `number`\n\nThe position at which to insert the ICNS Image.\n\n#### remove(index)\n\nRemoves ICNS image at the specified position.\n\n##### index\n\nType: `number`\n\nThe position of the ICNS Image to remove.\n\n#### fileHeader\n\nType: `IcnsFileHeader`\n\nReturn the file header on the ICNS.\n\n#### images\n\nType: `IcnsImage[]`\n\nReturn the ICNS images on the ICNS.\n\n#### data\n\nType: `Buffer`\n\nReturn the ICNS buffer.\n\n### Class: IcnsImage\n\n#### static from(buffer)\n\nCreate ICNS image from the buffer.\n\n##### buffer\n\nType: `Buffer`\n\nThe ICNS image buffer.\n\n#### static fromPNG(buffer, osType)\n\nCreate ICNS Image from the PNG image buffer.\n\n##### buffer\n\nType: `Buffer`\n\nThe PNG image buffer.\n\n##### osType\n\nType: `OSType`\n\nThe icon OSType.\n\n### Class: IcnsFileHeader\n\n#### static from(buffer)\n\nCreate ICNS file header from the buffer.\n\n##### buffer\n\nType: `Buffer`\n\nThe ICNS file header buffer.\n\n## Specifications\n\n### Supported OSTypes\n\n| OSType | OS Version | Size | Description                                                           |\n| ------ | ---------- | ---- | --------------------------------------------------------------------- |\n| is32   | 8.5        | 16   | 16×16 24-bit icon                                                     |\n| il32   | 8.5        | 32   | 32x32 24-bit icon                                                     |\n| ih32   | 8.5        | 48   | 48×48 24-bit icon                                                     |\n| it32   | 10.0       | 128  | 128x128 24-bit icon                                                   |\n| s8mk   | 8.5        | 16   | 16x16 8-bit mask                                                      |\n| l8mk   | 8.5        | 32   | 32×32 8-bit mask                                                      |\n| h8mk   | 8.5        | 48   | 48×48 8-bit mask                                                      |\n| t8mk   | 10.0       | 128  | 128x128 8-bit mask                                                    |\n| ic04   |            | 16   | 16x16 ARGB                                                            |\n| ic05   |            | 32   | 32x32 ARGB                                                            |\n| icp4   | 10.7       | 16   | 16x16 icon in PNG format                                              |\n| icp5   | 10.7       | 32   | 32x32 icon in PNG format                                              |\n| icp6   | 10.7       | 64   | 64x64 icon in PNG format                                              |\n| ic07   | 10.7       | 128  | 128x128 icon in PNG format                                            |\n| ic08   | 10.5       | 256  | 256×256 icon in PNG format                                            |\n| ic09   | 10.5       | 512  | 512×512 icon in PNG format                                            |\n| ic10   | 10.7       | 1024 | 1024×1024 in 10.7 (or 512x512@2x \"retina\" in 10.8) icon in PNG format |\n| ic11   | 10.8       | 32   | 16x16@2x \"retina\" icon in PNG format                                  |\n| ic12   | 10.8       | 64   | 32x32@2x \"retina\" icon in PNG format                                  |\n| ic13   | 10.8       | 256  | 128x128@2x \"retina\" icon in PNG format                                |\n| ic14   | 10.8       | 512  | 256x256@2x \"retina\" icon in PNG format                                |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffiahfy%2Ficns","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffiahfy%2Ficns","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffiahfy%2Ficns/lists"}