{"id":15660373,"url":"https://github.com/linusu/decode-ico","last_synced_at":"2025-04-30T07:08:55.035Z","repository":{"id":57211730,"uuid":"100401723","full_name":"LinusU/decode-ico","owner":"LinusU","description":"Decode `.ico` icons","archived":false,"fork":false,"pushed_at":"2022-11-15T09:53:00.000Z","size":137,"stargazers_count":19,"open_issues_count":2,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-30T07:08:48.384Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LinusU.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-08-15T17:24:01.000Z","updated_at":"2024-10-31T03:27:12.000Z","dependencies_parsed_at":"2023-01-21T19:01:07.372Z","dependency_job_id":null,"html_url":"https://github.com/LinusU/decode-ico","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LinusU%2Fdecode-ico","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LinusU%2Fdecode-ico/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LinusU%2Fdecode-ico/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LinusU%2Fdecode-ico/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LinusU","download_url":"https://codeload.github.com/LinusU/decode-ico/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251658211,"owners_count":21622821,"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-03T13:21:21.491Z","updated_at":"2025-04-30T07:08:55.012Z","avatar_url":"https://github.com/LinusU.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Decode ICO\n\nDecode `.ico` icons\n\n## Installation\n\n```sh\nnpm install --save decode-ico\n```\n\n## Usage\n\n```js\nconst decodeIco = require('decode-ico')\nconst fs = require('fs')\n\nconst source = fs.readFileSync('favicon.ico')\nconst images = decodeIco(source)\n\nconsole.log(images[0])\n//=\u003e { width: 16, height: 16, type: 'bmp', data: Uint8Array(...), bpp: 32, hotspot: null }\n\nconsole.log(images[1])\n//=\u003e { width: 32, height: 32, type: 'bmp', data: Uint8Array(...), bpp: 32, hotspot: null }\n```\n\n## API\n\n### `decodeIco(source: ArrayBuffer | Buffer) =\u003e Image[]`\n\nDecodes the `.ico` file in the given buffer, and returns an array of images.\n\nEach image has the following properties:\n\n- `width: Number` - The width of the image, in pixels\n- `height: Number` - The height of the image, in pixels\n- `type: String` - The type of image, will be one of `bmp` or `png`\n- `bpp: Number` - The color depth of the image as the number of bits used per pixel\n- `data: Uint8Array` - The data of the image, format depends on `type`, see below\n- `hotspot: null | Hotspot` - If the image is a cursor (`.cur`), this is the hotspot\n\nThe format of the `data` parameter depends on the type of image. When the image is of type `bmp`, the `data` array will hold raw pixel data in the RGBA order, with integer values between 0 and 255 (included). When the type is `png`, the array will be png data.\n\nThe `hotspot` property will either be `null`, or an object with an `x` and `y` property.\n\n💡 The `png` data can be written to a file with the `.png` extension directly, or be decoded by [node-lodepng](https://github.com/LinusU/node-lodepng) which will give you the same raw format as the `bmp` type.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinusu%2Fdecode-ico","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flinusu%2Fdecode-ico","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinusu%2Fdecode-ico/lists"}