{"id":16048916,"url":"https://github.com/devongovett/neuquant","last_synced_at":"2025-10-13T22:35:51.555Z","repository":{"id":23265544,"uuid":"26623959","full_name":"devongovett/neuquant","owner":"devongovett","description":"JavaScript port of the NeuQuant image quantization algorithm","archived":false,"fork":false,"pushed_at":"2020-01-07T02:33:49.000Z","size":629,"stargazers_count":26,"open_issues_count":1,"forks_count":4,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-02-28T01:48:36.447Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/devongovett.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":"2014-11-14T05:35:16.000Z","updated_at":"2023-07-07T00:39:35.000Z","dependencies_parsed_at":"2022-07-22T04:16:55.970Z","dependency_job_id":null,"html_url":"https://github.com/devongovett/neuquant","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devongovett%2Fneuquant","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devongovett%2Fneuquant/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devongovett%2Fneuquant/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devongovett%2Fneuquant/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devongovett","download_url":"https://codeload.github.com/devongovett/neuquant/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243871860,"owners_count":20361378,"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":[],"created_at":"2024-10-09T00:11:11.920Z","updated_at":"2025-10-13T22:35:46.510Z","avatar_url":"https://github.com/devongovett.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# neuquant\n\nA JavaScript port of Anthony Dekker's [NeuQuant](http://members.ozemail.com.au/~dekker/NEUQUANT.HTML) \nimage quantization algorithm including a [pixel-stream](https://github.com/devongovett/pixel-stream)\ninterface.\n\n## Installation\n\n    npm install neuquant\n\n## Example\n\n```javascript\nvar neuquant = require('neuquant');\nvar JPEGDecoder = require('jpg-stream/decoder');\nvar GIFDecoder = require('gif-stream/decoder');\n\n// get a palette and indexed pixel data for input RGB image\nvar res = neuquant.quantize(pixels, quality);\n// =\u003e { palette: \u003cBuffer ...\u003e, indexed: \u003cBuffer...\u003e }\n\n// streaming interface example\nfs.createReadStream('in.jpg')\n  .pipe(new JPEGDecoder)\n  .pipe(new neuquant.Stream)\n  .pipe(new GIFEncoder)\n  .pipe(fs.createWriteStream('out.gif'));\n```\n\n## API\n\n### `getPalette(pixels, quality = 10)`\n\nReturns a buffer containing a palette of 256 RGB colors for the input\nRGB image.  The quality parameter is set to `10` by default, but can \nbe changed to increase or decrease quality at the expense of performance.\nThe lower the number, the higher the quality.\n\n### `index(pixels, palette)`\n\nReturns a new buffer containing the indexed pixel data for the input\nimage using the given palette, which is a buffer obtained from the \nabove method.\n\n### `quantize(pixels, quality = 10)`\n\nCombines the above two methods and returns an object containing both\na palette buffer and the indexed pixel data at once.\n\n### `Stream`\n\nAs shown in the above example, a streaming API can also be used.\nYou can pipe data to it, including multi-frame data, and it will\nproduce an indexed output chunk for each frame. You can access the\npalette for each frame by listening for `frame` events on the stream.\n\n## Authors\n\n* The original [NeuQuant](http://members.ozemail.com.au/~dekker/NEUQUANT.HTML)\n    algorithm was developed by Anthony Dekker.\n\n* The JavaScript port of NeuQuant was originally done by Johan Nordberg\n    for [GIF.js](https://github.com/jnordberg/gif.js).\n    \n* Streaming interface, wrapper API, and code cleanup by Devon Govett.\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevongovett%2Fneuquant","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevongovett%2Fneuquant","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevongovett%2Fneuquant/lists"}