{"id":16048933,"url":"https://github.com/devongovett/gif-stream","last_synced_at":"2025-03-16T07:32:32.451Z","repository":{"id":23307774,"uuid":"26667346","full_name":"devongovett/gif-stream","owner":"devongovett","description":"A streaming GIF encoder and decoder","archived":false,"fork":false,"pushed_at":"2018-11-19T14:39:56.000Z","size":300,"stargazers_count":53,"open_issues_count":4,"forks_count":7,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-02-27T05:51:12.677Z","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":"sot/xija","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-15T03:03:21.000Z","updated_at":"2024-12-12T06:19:05.000Z","dependencies_parsed_at":"2022-08-20T00:00:23.642Z","dependency_job_id":null,"html_url":"https://github.com/devongovett/gif-stream","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devongovett%2Fgif-stream","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devongovett%2Fgif-stream/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devongovett%2Fgif-stream/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devongovett%2Fgif-stream/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devongovett","download_url":"https://codeload.github.com/devongovett/gif-stream/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243806052,"owners_count":20350775,"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:25.270Z","updated_at":"2025-03-16T07:32:32.148Z","avatar_url":"https://github.com/devongovett.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gif-stream\n\nA streaming GIF encoder and decoder for Node and the browser\n\n## Installation\n\n    npm install gif-stream\n\nFor the browser, you can build using [Browserify](http://browserify.org/).\n\n## Decoding Example\n\nThis example uses the [concat-frames](https://github.com/devongovett/concat-frames)\nmodule to collect the output of the GIF decoder into an array of frame objects.\n\n```javascript\nvar GIFDecoder = require('gif-stream/decoder');\nvar concat = require('concat-frames');\n\n// decode a GIF file to RGB pixels\nfs.createReadStream('in.gif')\n  .pipe(new GIFDecoder)\n  .pipe(concat(function(frames) {\n    // frames is an array of frame objects\n    // each one has a `pixels` property containing\n    // the raw RGB pixel data for that frame, as\n    // well as the width, height, etc.\n  }));\n```\n\n## Encoding Example\n\nYou can encode a GIF by writing or piping indexed/quantized data to a `GIFEncoder` stream.\nIf you write data to it manually, you need to first quantize the pixel data to produce a\ncolor palette and a buffer of indexed pixels.  You can use the [neuquant](https://github.com/devongovett/neuquant)\nmodule to do this.\n\nAlternatively, if you have a stream of RGB data already, you can pipe it first to a neuquant \nstream, and then to a GIF encoder, which will do the hard work of quantizing and writing\nindexed data for you.\n\n```javascript\nvar GIFEncoder = require('gif-stream/encoder');\nvar neuquant = require('neuquant');\n\n// encode an animated GIF file by writing pixels to it.\n// you need to manually quantize the data to produce a palette and indexed pixels.\nvar q = neuquant.quantize(pixels);\n\nvar enc = new GIFEncoder(width, height, { palette: q.palette });\nenc.pipe(fs.createWriteStream('out.gif'));\n\n// write indexed data\nenc.end(q.indexed);\n\n// or, pipe data from another RGB stream\n// boom: streaming image transcoding!\nfs.createReadStream('rgb.png')\n  .pipe(new PNGDecoder)\n  .pipe(new neuquant.Stream)\n  .pipe(new GIFEncoder)\n  .pipe(fs.createWriteStream('out.gif'));\n\n// maybe you want to preserve the original palette and indexing?\n// you can do that too!\nfs.createReadStream('rgb.png')\n  .pipe(new GIFDecoder({indexed: true}))\n  .pipe(new GIFEncoder)\n  .pipe(fs.createWriteStream('out.gif'));\n// somewhat useless example, but this may be useful for instance\n// if you are breaking an animated GIF into multiple static GIFs\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevongovett%2Fgif-stream","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevongovett%2Fgif-stream","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevongovett%2Fgif-stream/lists"}