{"id":13526405,"url":"https://github.com/eugeneware/gifencoder","last_synced_at":"2025-04-08T15:14:16.835Z","repository":{"id":11004960,"uuid":"13329152","full_name":"eugeneware/gifencoder","owner":"eugeneware","description":"Server side animated gif generation for node.js","archived":false,"fork":false,"pushed_at":"2021-05-31T18:57:27.000Z","size":112,"stargazers_count":473,"open_issues_count":18,"forks_count":51,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-03-30T00:02:58.398Z","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":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eugeneware.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-10-04T16:36:54.000Z","updated_at":"2024-12-15T15:58:47.000Z","dependencies_parsed_at":"2022-08-30T04:01:14.090Z","dependency_job_id":null,"html_url":"https://github.com/eugeneware/gifencoder","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eugeneware%2Fgifencoder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eugeneware%2Fgifencoder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eugeneware%2Fgifencoder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eugeneware%2Fgifencoder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eugeneware","download_url":"https://codeload.github.com/eugeneware/gifencoder/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247867362,"owners_count":21009240,"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-08-01T06:01:29.204Z","updated_at":"2025-04-08T15:14:16.815Z","avatar_url":"https://github.com/eugeneware.png","language":"JavaScript","readme":"# gifencoder\n\nStreaming server-side animated (and non-animated) gif generation for node.js\n\n[![build status](https://secure.travis-ci.org/eugeneware/gifencoder.png)](http://travis-ci.org/eugeneware/gifencoder)\n\n## Installation\n\nThis module is installed via npm:\n\n``` bash\n$ npm install gifencoder\n```\n\n## Streaming API - Duplex Piping with Writes\n\nYou can also stream writes of pixel data (or canvas contexts) to the encoder:\n\n``` js\nconst GIFEncoder = require('gifencoder');\nconst encoder = new GIFEncoder(854, 480);\nconst pngFileStream = require('png-file-stream');\nconst fs = require('fs');\n\nconst stream = pngFileStream('test/**/frame?.png')\n  .pipe(encoder.createWriteStream({ repeat: -1, delay: 500, quality: 10 }))\n  .pipe(fs.createWriteStream('myanimated.gif'));\n\nstream.on('finish', function () {\n  // Process generated GIF\n});\n\n// Alternately, you can wrap the \"finish\" event in a Promise\nawait new Promise((resolve, reject) =\u003e {\n  stream.on('finish', resolve);\n  stream.on('error', reject);\n});\n```\n\nNB: The chunks that get emitted by your read stream must either by a 1-dimensional bitmap of RGBA\ndata (either an array or Buffer), or a canvas 2D `context`.\n\n## Example: Streaming API - Reads\n\nYou can also use a streaming API to receive data:\n\n``` js\nconst GIFEncoder = require('gifencoder');\nconst { createCanvas } = require('canvas');\nconst fs = require('fs');\n\nconst encoder = new GIFEncoder(320, 240);\n// stream the results as they are available into myanimated.gif\nencoder.createReadStream().pipe(fs.createWriteStream('myanimated.gif'));\n\nencoder.start();\nencoder.setRepeat(0);   // 0 for repeat, -1 for no-repeat\nencoder.setDelay(500);  // frame delay in ms\nencoder.setQuality(10); // image quality. 10 is default.\n\n// use node-canvas\nconst canvas = createCanvas(320, 240);\nconst ctx = canvas.getContext('2d');\n\n// red rectangle\nctx.fillStyle = '#ff0000';\nctx.fillRect(0, 0, 320, 240);\nencoder.addFrame(ctx);\n\n// green rectangle\nctx.fillStyle = '#00ff00';\nctx.fillRect(0, 0, 320, 240);\nencoder.addFrame(ctx);\n\n// blue rectangle\nctx.fillStyle = '#0000ff';\nctx.fillRect(0, 0, 320, 240);\nencoder.addFrame(ctx);\n\nencoder.finish();\n```\nThe above code will generate the following animated GIF:\n\n![Animated GIF](https://raw.github.com/eugeneware/gifencoder/master/examples/myanimated.gif)\n\n## Contributing\n\ngifencoder is an **OPEN Open Source Project**. This means that:\n\n\u003e Individuals making significant and valuable contributions are given commit-access to the project to contribute as they see fit. This project is more like an open wiki than a standard guarded open source project.\n\nSee the [CONTRIBUTING.md](https://github.com/eugeneware/gifencoder/blob/master/CONTRIBUTING.md) file for more details.\n\n### Contributors\n\ngifencoder is only possible due to the excellent work of the following contributors:\n\n\u003ctable\u003e\u003ctbody\u003e\n\u003ctr\u003e\u003cth align=\"left\"\u003eKevin Weiner\u003c/th\u003e\u003ctd\u003e\u003ca href=\"mailto:kweiner@fmsware.com\"\u003ekweiner@fmsware.com\u003c/a\u003e\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003cth align=\"left\"\u003eThibault Imbert\u003c/th\u003e\u003ctd\u003e\u003ca href=\"http://www.bytearray.org/\"\u003ehttp://www.bytearray.org/\u003c/a\u003e\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003cth align=\"left\"\u003eEugene Ware\u003c/th\u003e\u003ctd\u003e\u003ca href=\"https://github.com/eugeneware\"\u003eGitHub/eugeneware\u003c/a\u003e\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003cth align=\"left\"\u003eRaine Virta\u003c/th\u003e\u003ctd\u003e\u003ca href=\"https://github.com/raine\"\u003eGitHub/raine\u003c/a\u003e\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003cth align=\"left\"\u003ePaul Ochoa\u003c/th\u003e\u003ctd\u003e\u003ca href=\"https://github.com/rochoa\"\u003eGitHub/rochoa\u003c/a\u003e\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003cth align=\"left\"\u003eHeikki Pora\u003c/th\u003e\u003ctd\u003e\u003ca href=\"https://github.com/heikkipora\"\u003eGitHub/heikkipora\u003c/a\u003e\u003c/td\u003e\u003c/tr\u003e\n\u003c/tbody\u003e\u003c/table\u003e\n","funding_links":[],"categories":["Libraries","Repository","JavaScript"],"sub_categories":["Javascript","Image","JavaScript"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feugeneware%2Fgifencoder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feugeneware%2Fgifencoder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feugeneware%2Fgifencoder/lists"}