{"id":20218383,"url":"https://github.com/skyra-project/gifenc","last_synced_at":"2025-04-06T06:12:54.090Z","repository":{"id":37017798,"uuid":"388814037","full_name":"skyra-project/gifenc","owner":"skyra-project","description":"A very fast server-side animated GIF generation for Node.js","archived":false,"fork":false,"pushed_at":"2025-03-30T01:22:59.000Z","size":15666,"stargazers_count":31,"open_issues_count":1,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-30T05:07:52.978Z","etag":null,"topics":["hacktoberfest"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/skyra-project.png","metadata":{"funding":{"github":["kyranet","favna"],"patreon":"kyranet","open_collective":null,"ko_fi":"kyranet","tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":["https://donate.skyra.pw/paypal","https://donate.favware.tech/paypal"]},"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-07-23T13:39:41.000Z","updated_at":"2025-03-30T01:22:34.000Z","dependencies_parsed_at":"2023-12-31T02:23:25.161Z","dependency_job_id":"345ac86f-5491-47b7-b0ec-95e875b0c8b0","html_url":"https://github.com/skyra-project/gifenc","commit_stats":{"total_commits":299,"total_committers":5,"mean_commits":59.8,"dds":"0.15384615384615385","last_synced_commit":"e4f88537fdede570019bb3ebdb0f5a05b31c4e92"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skyra-project%2Fgifenc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skyra-project%2Fgifenc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skyra-project%2Fgifenc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skyra-project%2Fgifenc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/skyra-project","download_url":"https://codeload.github.com/skyra-project/gifenc/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247441060,"owners_count":20939239,"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":["hacktoberfest"],"created_at":"2024-11-14T06:38:22.036Z","updated_at":"2025-04-06T06:12:54.070Z","avatar_url":"https://github.com/skyra-project.png","language":"TypeScript","funding_links":["https://github.com/sponsors/kyranet","https://github.com/sponsors/favna","https://patreon.com/kyranet","https://ko-fi.com/kyranet","https://donate.skyra.pw/paypal","https://donate.favware.tech/paypal","https://www.patreon.com/kyranet","https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick\u0026hosted_button_id=CET28NRZTDQ8L"],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n# @skyra/gifenc\n\n**A very fast server-side animated GIF generation for Node.js**\n\n[![GitHub](https://img.shields.io/github/license/skyra-project/gifenc)](https://github.com/skyra-project/gifenc/blob/main/LICENSE.md)\n\n[![npm](https://img.shields.io/npm/v/@skyra/gifenc?color=crimson\u0026label=NPM\u0026logo=npm)](https://www.npmjs.com/package/@skyra/gifenc)\n![npm bundle size minified (scoped)](https://img.shields.io/bundlephobia/min/@skyra/gifenc?label=minified\u0026logo=webpack)\n![npm bundle size minzipped (scoped)](https://img.shields.io/bundlephobia/minzip/@skyra/gifenc?label=minified\u0026logo=webpack)\n\n[![Support Server](https://discord.com/api/guilds/254360814063058944/embed.png?style=banner2)](https://join.skyra.pw)\n\n\u003c/div\u003e\n\n---\n\n## Features\n\n-   @skyra/gifenc is a GIF encoding utility library to build your next GIFs.\n-   Supports CommonJS and ES Module.\n-   Heavily based on [`gifencoder`](https://github.com/eugeneware/gifencoder), this module wouldn't have existed without its author.\n\n## Installation\n\nYou can use the following command to install this package, or replace `npm install` with your package manager of choice.\n\n```sh\nnpm install @skyra/gifenc\n```\n\n## Usage\n\n\u003e `@skyra/gifenc` is very close to a drop-in replacement for [`gifencoder`](https://www.npmjs.com/package/gifencoder). There are only 2 differences to account for. First of all, the encoder class is named `GifEncoder` and not `GIFEncoder`, and secondly, the metadata methods are chainable.\n\n### Streaming API - Writing to a file\n\n```js\nconst { GifEncoder } = require('@skyra/gifenc');\nconst { createWriteStream } = require('node:fs');\n\nconst encoder = new GifEncoder(400, 400);\n\t// Set the repeat mode: 0 for repeat, -1 for no-repeat:\n\t.setRepeat(0)\n\t// Set the frame delay in milliseconds:\n\t.setDelay(500)\n\t// Set the image quality, 10 is default:\n\t.setQuality(10);\n\n// Create a read stream and pipe it into a file write stream:\nencoder.createReadStream()\n\t.pipe(createWriteStream('my-file.gif'));\n\nencoder.start();\n\n// `getFrames` enumerates over frames\nfor (const frame of getFrames()) {\n\tencoder.addFrame(frame);\n}\n\nencoder.finish();\n```\n\n### Streaming API - Get resulting Buffer\n\nWe can use [`streamConsumers.buffer()`](https://nodejs.org/dist/latest-v16.x/docs/api/webstreams.html#streamconsumersbufferstream) from Node.js to convert the stream into a buffer starting with Node.js v16.7.0, if you're using an older version, consider making a function using stream's async iterator (Node.js v10+) or use a package.\n\n```js\nconst { GifEncoder } = require('@skyra/gifenc');\nconst { buffer } = require('node:stream/consumers');\n\nconst encoder = new GifEncoder(400, 400);\n\nconst stream = encoder.createReadStream();\nencoder.setRepeat(0).setDelay(500).setQuality(10).start();\n\n// `getFrames` enumerates over frames\nfor (const frame of getFrames()) {\n\tencoder.addFrame(frame);\n}\n\nencoder.finish();\nconst result = await buffer(stream);\n```\n\n### Using with canvas-constructor\n\n```js\nconst { GifEncoder } = require('@skyra/gifenc');\nconst { Canvas } = require('canvas-constructor/skia');\n// const { Canvas } = require('canvas-constructor/cairo');\n\nconst canvas = new Canvas(400, 400);\nconst encoder = new GifEncoder(400, 400);\n\nconst stream = encoder.createReadStream();\nencoder.setRepeat(0).setDelay(500).setQuality(10).start();\n\nconst colors = ['#98DDCA', '#D5ECC2', '#FFD3B4', '#FFAAA7'];\nfor (const color of colors) {\n\tcanvas.setColor(color).printRectangle(0, 0, 400, 400);\n\tencoder.addFrame(canvas);\n}\n\n// ...\n```\n\n### Using with ECMAScript Modules\n\n`@skyra/gifenc` supports ESM out of the box. To import the `GifEncoder` class, you use the following statement:\n\n```ts\nimport { GifEncoder } from '@skyra/gifenc';\n```\n\n## Buy us some doughnuts\n\nSkyra Project is open source and always will be, even if we don't get donations. That said, we know there are amazing people who\nmay still want to donate just to show their appreciation. Thanks you very much in advance!\n\nWe accept donations through Patreon, BitCoin, Ethereum, and Litecoin. You can use the buttons below to donate through your method of choice.\n\n| Donate With |         QR         |                                                                  Address                                                                  |\n| :---------: | :----------------: | :---------------------------------------------------------------------------------------------------------------------------------------: |\n|   Patreon   | ![PatreonImage][]  |                                               [Click Here](https://www.patreon.com/kyranet)                                               |\n|   PayPal    |  ![PayPalImage][]  |                     [Click Here](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick\u0026hosted_button_id=CET28NRZTDQ8L)                      |\n|   BitCoin   | ![BitcoinImage][]  |         [3JNzCHMTFtxYFWBnVtDM9Tt34zFbKvdwco](bitcoin:3JNzCHMTFtxYFWBnVtDM9Tt34zFbKvdwco?amount=0.01\u0026label=Skyra%20Discord%20Bot)          |\n|  Ethereum   | ![EthereumImage][] | [0xcB5EDB76Bc9E389514F905D9680589004C00190c](ethereum:0xcB5EDB76Bc9E389514F905D9680589004C00190c?amount=0.01\u0026label=Skyra%20Discord%20Bot) |\n|  Litecoin   | ![LitecoinImage][] |         [MNVT1keYGMfGp7vWmcYjCS8ntU8LNvjnqM](litecoin:MNVT1keYGMfGp7vWmcYjCS8ntU8LNvjnqM?amount=0.01\u0026label=Skyra%20Discord%20Bot)         |\n\n## Contributors\n\nPlease make sure to read the [Contributing Guide][contributing] before making a pull request.\n\nThank you to all the people who already contributed to Skyra Project!\n\n\u003ca href=\"https://github.com/skyra-project/gifenc/graphs/contributors\"\u003e\n  \u003cimg src=\"https://contrib.rocks/image?repo=skyra-project/gifenc\" /\u003e\n\u003c/a\u003e\n\n[contributing]: https://github.com/skyra-project/.github/blob/main/.github/CONTRIBUTING.md[patreonimage]: https://cdn.skyra.pw/gh-assets/patreon.png\n[paypalimage]: https://cdn.skyra.pw/gh-assets/paypal.png\n[bitcoinimage]: https://cdn.skyra.pw/gh-assets/bitcoin.png\n[ethereumimage]: https://cdn.skyra.pw/gh-assets/ethereum.png\n[litecoinimage]: https://cdn.skyra.pw/gh-assets/litecoin.png\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskyra-project%2Fgifenc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fskyra-project%2Fgifenc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskyra-project%2Fgifenc/lists"}