{"id":13623122,"url":"https://github.com/danielepiccone/ditherjs","last_synced_at":"2026-03-05T01:03:18.858Z","repository":{"id":13949516,"uuid":"16649556","full_name":"danielepiccone/ditherjs","owner":"danielepiccone","description":"A javascript library which dithers an \u003cimg\u003e using a fixed palette","archived":false,"fork":false,"pushed_at":"2023-05-17T15:39:24.000Z","size":1937,"stargazers_count":152,"open_issues_count":6,"forks_count":21,"subscribers_count":5,"default_branch":"master","last_synced_at":"2026-01-14T00:10:26.169Z","etag":null,"topics":["canvas","colors","dithering","javascript-library","jquery-plugin","retro"],"latest_commit_sha":null,"homepage":"http://danielepiccone.github.io/ditherjs/","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/danielepiccone.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,"roadmap":null,"authors":null}},"created_at":"2014-02-08T18:16:20.000Z","updated_at":"2025-12-23T10:16:15.000Z","dependencies_parsed_at":"2024-01-14T06:54:09.636Z","dependency_job_id":"0f2ad3b9-8c60-4aa4-b591-093d31cb20eb","html_url":"https://github.com/danielepiccone/ditherjs","commit_stats":null,"previous_names":["dpiccone/ditherjs"],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/danielepiccone/ditherjs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielepiccone%2Fditherjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielepiccone%2Fditherjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielepiccone%2Fditherjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielepiccone%2Fditherjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danielepiccone","download_url":"https://codeload.github.com/danielepiccone/ditherjs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielepiccone%2Fditherjs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30104218,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-05T00:38:46.881Z","status":"ssl_error","status_checked_at":"2026-03-05T00:38:45.829Z","response_time":59,"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":["canvas","colors","dithering","javascript-library","jquery-plugin","retro"],"created_at":"2024-08-01T21:01:28.347Z","updated_at":"2026-03-05T01:03:13.843Z","avatar_url":"https://github.com/danielepiccone.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# ditherJS\n\n[![License: CC BY-SA 4.0](https://img.shields.io/badge/License-CC%20BY--SA%204.0-lightgrey.svg)](http://creativecommons.org/licenses/by-sa/4.0/)\n\nA javascript library which dithers an image using a fixed palette.\n\nRun `npm run demo:client` or `npm run demo:sever` to see it in action.\n\n## Installation and dependencies\n\n```sh\n$ npm install ditherjs --save\n```\n\nBoth client and server are exposed as commonJS modules to be used with webpack or browserify.\n\nThe client-side version is also published with an UMD compatible wrapper and a jQuery plugin, those versions are in `./dist`\n\nThe server-side version needs [node-canvas](https://github.com/Automattic/node-canvas) installed as a peer dependency to work, this is also needed to run run the tests during development.\n\n```sh\n$ npm install ditherjs canvas --save\n```\n\n## Usage and options\n\nAny DitherJS instance exposes a `dither(target, [options])` method which accepts a *selector* a *Node\u003cimg\u003e* or a *buffer* as a target and an optional options object.\n\nThe options can be passed directly to the method or directly in the constructor.\n\n```javascript\nvar options = {\n    \"step\": 1, // The step for the pixel quantization n = 1,2,3...\n    \"palette\": defaultPalette, // an array of colors as rgb arrays\n    \"algorithm\": \"ordered\" // one of [\"ordered\", \"diffusion\", \"atkinson\"]\n};\n```\n\nA default palette is provided which is CGA Palette 1\n\n![Rick dangerhous II](http://www.rickdangerous.co.uk/cga20a.png)\n\nThe palette structure is as an array of rgb colors `[[r,g,b]..]`\n\n### Client\n\n\n```javascript\nvar DitherJS = require('ditherjs');\n\nvar ditherjs = new DitherJS([,options]);\nditherjs.dither(selector,[,options]); // should target \u003cimg\u003e elements\n```\n\nas a jQuery plugin\n```javascript\n$('.dither').ditherJS(options);\n```\n\nor directly on the element\n```html\n\u003cimg src=\"...\" onload=\"ditherjs.dither(this)\" /\u003e\n```\n\n## Server\n\n```javascript\nvar DitherJS = require('ditherjs/server');\n\nvar ditherjs = new DitherJS([,options]);\n\n// Get a buffer that can be loaded into a canvas\nvar buffer = fs.readFileSync('./myBeautifulFile.jpg|gif|png');\n\nditherjs.dither(buffer,[,options]);\n```\n\n### Testimonials\n\nUseful as a comb to a bald man. -Anon\n\nauthor 2014 [Daniele Piccone](http://www.danielepiccone.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielepiccone%2Fditherjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanielepiccone%2Fditherjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielepiccone%2Fditherjs/lists"}