{"id":13472055,"url":"https://github.com/square/gifencoder","last_synced_at":"2025-06-13T01:40:09.034Z","repository":{"id":55644065,"uuid":"75039592","full_name":"square/gifencoder","owner":"square","description":"A pure Java library implementing the GIF89a specification. Suitable for use on Android.","archived":false,"fork":false,"pushed_at":"2023-05-09T21:15:01.000Z","size":1729,"stargazers_count":655,"open_issues_count":3,"forks_count":74,"subscribers_count":19,"default_branch":"master","last_synced_at":"2024-04-13T17:52:12.820Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/square.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2016-11-29T03:32:18.000Z","updated_at":"2024-03-31T14:18:42.000Z","dependencies_parsed_at":"2022-08-15T05:20:41.327Z","dependency_job_id":"890d2ac8-218d-48cb-8140-f4089b368da7","html_url":"https://github.com/square/gifencoder","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/square%2Fgifencoder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/square%2Fgifencoder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/square%2Fgifencoder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/square%2Fgifencoder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/square","download_url":"https://codeload.github.com/square/gifencoder/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222151628,"owners_count":16939423,"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-07-31T16:00:51.469Z","updated_at":"2024-10-30T02:31:22.254Z","avatar_url":"https://github.com/square.png","language":"Java","funding_links":[],"categories":["Java"],"sub_categories":[],"readme":"# gifencoder\n\ngifencoder is a pure Java library implementing the [GIF89a specification](http://www.w3.org/Graphics/GIF/spec-gif89a.txt). It does not use AWT's `BufferedImage`, so it can be used on Android and other platforms lacking AWT.\n\nThere is currently no support for transparency.\n\n\n### Quantization and dithering\n\nGIF images are limited to 256 colors. If you supply an image with more colors, gifencoder's default behavior is to perform [median-cut quantization](http://en.wikipedia.org/wiki/Median_cut) with [Floyd-Steinberg dithering](http://en.wikipedia.org/wiki/Floyd%E2%80%93Steinberg_dithering). You can configure this behavior through `ImageOptions`. A handful of quantizers and ditherers are provided, but you can also plug in your own implementation.\n\n\n### Basic usage\n\n```java\nint[][] rgbDataFrame1 = ...;\nint[][] rgbDataFrame2 = ...;\nint[][] rgbDataFrame3 = ...;\n\nOutputStream outputStream = new FileOutputStream(\"test.gif\");\nImageOptions options = new ImageOptions();\nnew GifEncoder(outputStream, width, height, 0)\n        .addImage(rgbDataFrame1, options)\n        .addImage(rgbDataFrame2, options)\n        .addImage(rgbDataFrame3, options)\n        .finishEncoding();\noutputStream.close();\n```\n\n\n### Download\n\nGradle:\n```groovy\ncompile 'com.squareup:gifencoder:0.10.1'\n```\nMaven:\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.squareup\u003c/groupId\u003e\n  \u003cartifactId\u003egifencoder\u003c/artifactId\u003e\n  \u003cversion\u003e0.10.1\u003c/version\u003e\n\u003c/dependency\u003e\n```\nOr download [the latest JAR][jar]. \n\nSnapshots of the development version are available in [Sonatype's `snapshots` repository][snap].\n\n\n### Gallery\n\nSimple animation with median-cut quantization and Floyd-Steinberg dithering:\n\n![simple animation](gallery/simple-animation.gif)\n\nLenna, original PNG:\n\n![Lenna original](gallery/lenna-original.png)\n\nLenna with uniform quantization and Floyd-Steinberg dithering:\n\n![Lenna with uniform quantization and Floyd-Steinberg dithering](gallery/lenna-uniform.gif)\n\nLenna GIF with median-cut quantization and Floyd-Steinberg dithering:\n\n![Lenna with median-cut quantization and Floyd-Steinberg dithering](gallery/lenna-median-cut.gif)\n\nLenna GIF with k-means quantization and Floyd-Steinberg dithering:\n\n![Lenna with k-means quantization and Floyd-Steinberg dithering](gallery/lenna-k-means.gif)\n\n\n\nLicense\n=======\n\n    Copyright 2015 Square, Inc.\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n\n\n [jar]: https://search.maven.org/remote_content?g=com.squareup\u0026a=gifencoder\u0026v=LATEST\n [snap]: https://oss.sonatype.org/content/repositories/snapshots/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsquare%2Fgifencoder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsquare%2Fgifencoder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsquare%2Fgifencoder/lists"}