{"id":14483678,"url":"https://github.com/und3f/vectorize-pixelart","last_synced_at":"2025-04-10T01:32:39.232Z","repository":{"id":35081007,"uuid":"202122275","full_name":"und3f/vectorize-pixelart","owner":"und3f","description":"Convert raster pixel art graphics to vector","archived":false,"fork":false,"pushed_at":"2023-07-19T04:23:36.000Z","size":415,"stargazers_count":39,"open_issues_count":2,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-18T15:49:47.397Z","etag":null,"topics":["pixel-art","typesscript","vectorization"],"latest_commit_sha":null,"homepage":"http://zasenko.name/vectorize-pixelart.html","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/und3f.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":"2019-08-13T10:39:56.000Z","updated_at":"2025-02-22T22:44:49.000Z","dependencies_parsed_at":"2024-11-06T21:42:49.451Z","dependency_job_id":"dd3eb01a-8203-4187-98cd-644a4db6d995","html_url":"https://github.com/und3f/vectorize-pixelart","commit_stats":{"total_commits":32,"total_committers":2,"mean_commits":16.0,"dds":0.125,"last_synced_commit":"9ee5f627b021f5b82efe2b164c15e765d95d55f7"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/und3f%2Fvectorize-pixelart","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/und3f%2Fvectorize-pixelart/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/und3f%2Fvectorize-pixelart/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/und3f%2Fvectorize-pixelart/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/und3f","download_url":"https://codeload.github.com/und3f/vectorize-pixelart/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248140754,"owners_count":21054349,"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":["pixel-art","typesscript","vectorization"],"created_at":"2024-09-03T00:01:59.115Z","updated_at":"2025-04-10T01:32:34.218Z","avatar_url":"https://github.com/und3f.png","language":"TypeScript","readme":"[![build-test](https://github.com/und3f/vectorize-pixelart/actions/workflows/main.yml/badge.svg)](https://github.com/und3f/vectorize-pixelart/actions/workflows/main.yml)\n\nvectorize-pixelart\n==================\n\nConvert raster pixel art graphics to vector.\n\n# Installation\n\n    $ npm install vectorize-pixelart\n\n# CLI usage\n\nYou may vectorize PNG image to SVG using next command:\n\n    $ vectorize-pixelart input.png output.svg\n\nAlso EPS output is supported:\n\n    $ vectorize-pixelart input.png output.eps\n\n# Online web usage\n\nThe package has been build with a [Browserify](browserify.org) version and\navailable online:\n\nhttp://zasenko.name/vectorize-pixelart.html\n\nMain limitation of the web version is that browser has issues when processing\nlarge SVG files. As there are no control over image displaying some resulting\nSVG might cause browser hang.\n\n# API\n\nPlease check [vectorize-pixelart.js](src/vectorize-pixelart.ts) code.\n\nSo, basic usage is next:\n\n1. Read raster image.\n2. Trace image\n\n```js\nvar fs  = require('fs'),\n    PNG = require('pngjs').PNG,\n    ContourTracing = require('vectorize-pixelart/contour-tracing'),\n    paUtils = require('vectorize-pixelart/utils');\n\n// PNGImageData provides transparent pixel retrieving/comparasion interface\nlet image = new paUtils.PNGImageData(PNG.sync.read(fs.readFileSync('in.png')));\n\n// Vector composer\nlet composer = new paUtils.SVG(image.height, image.width);\n\nprocess.stdout.write(composer.header());\n\nlet tracer = new ContourTracing(image);\ntracer.traceContours((contour, pixel) =\u003e {\n    // Output next traced contour\n    process.stdout.write(composer.path(contour, pixel));\n})\n\nprocess.stdout.write(composer.footer());\n```\n\n## Class: ContourTracing\n\nTrace contours of a given `image`.\n\n### new ContourTracing(image)\n\nObject image should contain `height` and `width` information. Also it should\nprovide `function comparePixels(y1, x1, y2, x2) { }` and `function getPixel(y1,\nx1)`. See `PNGImageData`.\n\n### ContourTracing.traceContours(callback)\nTraces contours of a given image and return next contour to callback. The\ncallback gets one argument `(contour)` that contains array of contour points \n`[y, x]`.\n\n# Copyright\n\nCopyright (C) 2019-2022 Sergii Zasenko\n\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program.  If not, see \u003chttps://www.gnu.org/licenses/\u003e.\n","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fund3f%2Fvectorize-pixelart","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fund3f%2Fvectorize-pixelart","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fund3f%2Fvectorize-pixelart/lists"}