{"id":44082993,"url":"https://github.com/solosodium/image-pixelizer","last_synced_at":"2026-02-08T09:30:44.269Z","repository":{"id":57272098,"uuid":"130629038","full_name":"solosodium/image-pixelizer","owner":"solosodium","description":"A tool to generate pixel arts from images","archived":false,"fork":false,"pushed_at":"2022-02-28T04:22:16.000Z","size":13449,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-25T04:29:30.126Z","etag":null,"topics":["image-processing","nodejs","pixel-art"],"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/solosodium.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":"2018-04-23T02:25:42.000Z","updated_at":"2024-05-30T13:43:53.000Z","dependencies_parsed_at":"2022-09-11T13:20:48.812Z","dependency_job_id":null,"html_url":"https://github.com/solosodium/image-pixelizer","commit_stats":null,"previous_names":["solosodium/pixelizer"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/solosodium/image-pixelizer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solosodium%2Fimage-pixelizer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solosodium%2Fimage-pixelizer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solosodium%2Fimage-pixelizer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solosodium%2Fimage-pixelizer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/solosodium","download_url":"https://codeload.github.com/solosodium/image-pixelizer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solosodium%2Fimage-pixelizer/sbom","scorecard":{"id":837225,"data":{"date":"2025-08-11","repo":{"name":"github.com/solosodium/image-pixelizer","commit":"8e39eead1e3ab147ae4edb88c0cce4a947d8699c"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.6,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-23T19:25:26.943Z","repository_id":57272098,"created_at":"2025-08-23T19:25:26.943Z","updated_at":"2025-08-23T19:25:26.943Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29226467,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-08T09:15:18.648Z","status":"ssl_error","status_checked_at":"2026-02-08T09:14:33.745Z","response_time":57,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["image-processing","nodejs","pixel-art"],"created_at":"2026-02-08T09:30:39.053Z","updated_at":"2026-02-08T09:30:44.264Z","avatar_url":"https://github.com/solosodium.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# image-pixelizer\n\nA tool to generate pixel arts from images.\n\n![Example](/images/example.png)\n\n1280 x 1280 pixelized to 128 x 128 with 64 distinct colors.\n\n## Release Notes\n\nVersion 1.1.0\n* Stable RGBA -\u003e XYZA -\u003e LAB(alpha) conversion.\n* Improved color difference performance.\n\nVersion 1.0.7\n* Fixed a minor bug in distribution version of the vanila Javascript libraies.\n\nVersion 1.0.6\n* Added RGBA to LAB (through XYZ) color conversion for more accurate color comparison.\n* Added support for vanila Javascript use case: [image-pixelizer.min.js](dist/image-pixelizer.min.js).\n\n## Algorithm\n\nThis tool uses a simple two-stage algorithm to create pixel arts from images.\n\n1. **Pixel clustering**: Cluster pixels based on their similarity in color and relative distance.\n1. **Color Reduction**: Reduce the number of colors of the clustered image to maximize color diversity.\n\n## Install\n\n```shell\nnpm install image-pixelizer --save\n```\n\n## Usage\n\n```javascript\n// Import Pixelizer.\nconst Pixelizer = require('image-pixelizer');\n\n// Create Options for Pixelizer.\nlet options = new Pixelizer.Options()\n    .setPixelSize(1)\n    .setColorDistRatio(0.5)\n    .setClusterThreshold(0.01)\n    .setMaxIteration(10)\n    .setNumberOfColors(128);\n\n// Create compatible input Bitmap.\nlet inputBitmap = new Pixelizer.Bitmap(\n    1920,   // width in pixels\n    1080,   // height in pixels\n    [...]   // one dimension data array for RGBA bitmap\n);\n\n// Pixelize!\nlet outputBitmap = \n    new Pixelizer(inputBitmap, options).pixelize();\n```\n## Options\n\nThere are in total 5 options for the Pixelizer.\n\n1. **Pixel Size**: This is size of output bitmap pixel in terms of the input bitmap pixels. For example, if this number is 10, each output bitmap pixel represents a 10x10 square (100 pixels) in the input bitmap.\n1. **Color Distance Ratio**: This is a 0 to 1 factor which tunes the weights assigned to pixel color difference and distance difference during clustering. 0 means only using distance difference when deciding which cluster a pixel goes to, while 1 means only use the color difference.\n1. **Cluster Threshold**: This is the ratio between number of pixels that changed cluster and number of total pixels, which is used as the primary condition to stop clustering. For example, if this number is 0.01, it means algorithm will stop clustering if less than 1% of pixels changed cluster assignment during the last iteration. \n1. **Maximum Iteration**: This is the maximum number of iterations allowed during pixel clustering stage. This is set as a hard stop condition to avoid clustering that does not converge.\n1. **Number of Colors**: This is the intended number of colors in the output bitmap.\n\nDefault values:\n\n* *pixelSize = 1*\n* *colorDistRatio = 0.5*\n* *clusterThreshold = 0.01*\n* *maxIteration = 10*\n* *numberOfColors = 128*\n\n## Bitmap\n\nBitmap is a light-weight wrapper class to represent a RGBA bitmap image. It's created with width, height (both in pixels) and a one dimensional data array containing RGBA values for all pixels. Each RGBA value should be a number between 0 to 255.\n\nAn extremely simple example which has 4 pixels:\n\n```\n|------------------------|-----------------------|\n| black (0, 0, 0, 255)   | red (255, 0, 0, 255)  |\n|------------------------|-----------------------|\n| green (0, 255, 0, 255) | blue (0, 0, 255, 255) |\n|------------------------|-----------------------|\n```\n\nTo create this bitmap:\n\n```javascript\nlet bitmap = new Pixelizer.Bitmap(\n    2, \n    2,\n    [\n        0,   0,   0,   255,     // black\n        255, 0,   0,   255,     // red\n        0,   255, 0,   255,     // green\n        0,   0,   255, 255      // blue\n    ]\n);\n```\n\nIf you use [jimp](https://www.npmjs.com/package/jimp), you might notice this shares similarity with its bitmap. This is by design, which means you can create Pixelizer Bitmap directly from jimp, and use jimp to output image file by overriding its bitmap:\n\n```javascript\nJimp.read('lenna.png')\n  .then(lenna =\u003e {\n      // Create Pixelizer bitmap from jimp.\n      let inputBitmap = new Pixelizer.Bitmap(\n          lenna.bitmap.width,\n          lenna.bitmap.height,\n          lenna.bitmap.data\n      );\n      // Pixelizer processing code...\n      let outputBitmap = ...\n      // Override jimp bitmap and output image.\n      lenna.bitmap.width = outputBitmap.width;\n      lenna.bitmap.height = outputBitmap.height;\n      lenna.bitmap.data = outputBitmap.data;\n      lenna.write('lenna-pixel.png');\n  })\n  .catch(err =\u003e {\n    console.error(err);\n  });\n```\n\nAs you can see, there is no deep integration with jimp for the Bitmap class, so this package can be used in more use cases (of course, with the help of more adapter code for Bitmap).\n \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsolosodium%2Fimage-pixelizer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsolosodium%2Fimage-pixelizer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsolosodium%2Fimage-pixelizer/lists"}