{"id":29212048,"url":"https://github.com/ialoig/nodejs-png2svg","last_synced_at":"2026-04-25T08:35:13.900Z","repository":{"id":185842570,"uuid":"466072617","full_name":"ialoig/nodejs-png2svg","owner":"ialoig","description":"Convert a PNG image to SVG passing from a RLE encoding 🔒🧑‍💻","archived":false,"fork":false,"pushed_at":"2023-09-20T08:24:30.000Z","size":223,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2023-09-20T19:52:21.107Z","etag":null,"topics":["encoding","nodejs","png-encoder","rle-decoder","rle-encoder","svg"],"latest_commit_sha":null,"homepage":"","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/ialoig.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,"governance":null}},"created_at":"2022-03-04T10:04:42.000Z","updated_at":"2023-03-26T01:02:28.000Z","dependencies_parsed_at":null,"dependency_job_id":"25c1f49e-fa22-4556-a8de-e7fc835f7b4d","html_url":"https://github.com/ialoig/nodejs-png2svg","commit_stats":null,"previous_names":["ialoig/nodejs-png2svg"],"tags_count":0,"template":null,"template_full_name":null,"purl":"pkg:github/ialoig/nodejs-png2svg","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ialoig%2Fnodejs-png2svg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ialoig%2Fnodejs-png2svg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ialoig%2Fnodejs-png2svg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ialoig%2Fnodejs-png2svg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ialoig","download_url":"https://codeload.github.com/ialoig/nodejs-png2svg/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ialoig%2Fnodejs-png2svg/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263222519,"owners_count":23433031,"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":["encoding","nodejs","png-encoder","rle-decoder","rle-encoder","svg"],"created_at":"2025-07-02T22:06:53.750Z","updated_at":"2026-04-25T08:35:13.838Z","avatar_url":"https://github.com/ialoig.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🖼 png-2-svg\n\n## Generate SVG from PNG\n\nStarting reading a `PNG` file, script compress the image using `RLE` (run-length encoding) and then convert it in  `SVG` format.\n\nHere **high-level** steps:\n\n1. 🖼 Read a png image trough `pngjs` library\n2. 📥 Encode png data using run-length encoding in the format 'hexColor' + 'width' (ex. #ffffff32) where:\n\n- **hexColor** (#ffffff): hexadecimal pixel color\n\n- **width** (32): number of pixels in a row\n\n3. 📤 Decode RLE information and convert them in svg rects of `width=witdh` and `height=1`\n\n## RLE encoding\n\n`Run-length encoding (RLE)` is a form of lossless data compression in which runs of data (sequences in which the same data value occurs in many consecutive data elements) are stored as a single data value and count, rather than as the original run.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"./src/data/rle.png\"\u003e\n\u003c/p\u003e\n\n## 🔗 Useful links\n\n- [Run-length encoding](https://en.wikipedia.org/wiki/Run-length_encoding)\n- [bitmap-js](https://github.com/ericandrewlewis/bitmap-js)\n- [create bitmap using js](https://rephrase.net/box/bitmap/)\n- [colors-converter](https://github.com/catamphetamine/color-space/blob/b940ca709c99048ee9ff3a91b7b66fdb78db72a8/source/index.js)\n\n## 🚀 Getting Started\n\nHere the list of available scripts:\n\n### export png to svg\n\nLooks for png files into the folder */src/data/images* and exports them in svg format under */src/data/export*\n\n```shell\n npm run export\n```\n\n### encode a png file using RLE\n\nLooks for png files into the folder */src/data/images* and exports the rle encoding under */src/data/encode*\n\n```shell\n npm run encode\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fialoig%2Fnodejs-png2svg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fialoig%2Fnodejs-png2svg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fialoig%2Fnodejs-png2svg/lists"}