{"id":18246646,"url":"https://github.com/datvm/png2icojs","last_synced_at":"2025-09-12T05:34:23.191Z","repository":{"id":143659162,"uuid":"489473475","full_name":"datvm/PNG2ICOjs","owner":"datvm","description":"A pure Javascript library to convert PNG files into ICO file","archived":false,"fork":false,"pushed_at":"2022-05-09T16:37:59.000Z","size":34,"stargazers_count":23,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-04T14:38:12.750Z","etag":null,"topics":["convert","es6","ico","icon","module","png"],"latest_commit_sha":null,"homepage":"https://png2icojs.lukevo.com/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/datvm.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":"2022-05-06T19:37:18.000Z","updated_at":"2025-03-20T06:15:07.000Z","dependencies_parsed_at":null,"dependency_job_id":"9c796fe8-90de-46a9-b8f9-6f921dd06bf6","html_url":"https://github.com/datvm/PNG2ICOjs","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/datvm/PNG2ICOjs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datvm%2FPNG2ICOjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datvm%2FPNG2ICOjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datvm%2FPNG2ICOjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datvm%2FPNG2ICOjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/datvm","download_url":"https://codeload.github.com/datvm/PNG2ICOjs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datvm%2FPNG2ICOjs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274759115,"owners_count":25343872,"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","status":"online","status_checked_at":"2025-09-12T02:00:09.324Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["convert","es6","ico","icon","module","png"],"created_at":"2024-11-05T09:27:08.349Z","updated_at":"2025-09-12T05:34:23.138Z","avatar_url":"https://github.com/datvm.png","language":"TypeScript","readme":"`PNG2ICOjs` is a simple and small (1.31KB minified) Javascript ES6 module that convert PNG files into [ICO file](https://en.wikipedia.org/wiki/ICO_(file_format)). It should work on any Javascript environment including browsers.\n\nWas it helpful for you? Please consider a donation ❤️ [PayPal](https://paypal.me/datvm).\n\n# Installation \u0026 Usage\n\nRight now I haven't deployed the library to any CDN yet. Please grab the script files in [Release page](https://github.com/datvm/PNG2ICOjs/releases). It is available in `TypeScript` and `Javascript` file.\n\nTo use the module, simply import it in your script:\n\n```ts\nimport { PngIcoConverter } from \"../src/png2icojs.js\";\n\n// ...\n\nconst inputs = [...files].map(file =\u003e ({\n    png: file\n}));\n\n// Result is a Blob\nconst resultBlob1 = await converter.convertToBlobAsync(inputs); // Default mime type is image/x-icon\nconst resultBlob2 = await converter.convertToBlobAsync(inputs, \"image/your-own-mime\");\n\n// Result is an Uint8Array\nconst resultArr = await converter.convertAsync(inputs);\n```\n\nYou can check the demo at [the Demo page](https://png2icojs.lukevo.com/).\n\n# API\n\nThe API exposes the `PngIcoConverter` class with many `protected` function so you can override them to your need.\n\n## Methods\n\n`PngIcoConverter` exposes publicly the following methods:\n\n- `async convertToBlobAsync(inputs: IConvertInputItem[], mime = IcoMime): Promise\u003cBlob\u003e;`\n\nConvert PNG files into a ICO Blob with optional mime type. Default: `image/x-icon`.\n\n- `async convertAsync(inputs: IConvertInputItem[]): Promise\u003cUint8Array\u003e;`\n\nConvert PNG files into a `Uint8Array`.\n\n## Input Options\n\n`IConvertInputItem` has the following properties:\n\n- `png`: the PNG file. Can be `Blob` or `ArrayBuffer`.\n\n- `bpp` (optional, default 0): Bits per pixel. For the header of the ICO image. In my experiments, most apps just ignore this value altogether and use the value from PNG image.\n\n- `ignoreSize` (optional, default false): Due to the `size` byte of ICO only has 1 byte, the maximum size of icons are 256px. However I have attemped to make an icon with 512px icon and it works so far. The library still throw an `Error` if your image size is more than 256px. Set this to `true` to ignore it.\n","funding_links":["https://paypal.me/datvm"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatvm%2Fpng2icojs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdatvm%2Fpng2icojs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatvm%2Fpng2icojs/lists"}