{"id":13995435,"url":"https://github.com/image-rs/image-gif","last_synced_at":"2025-05-14T17:09:07.544Z","repository":{"id":32913422,"uuid":"36508652","full_name":"image-rs/image-gif","owner":"image-rs","description":"GIF en- and decoder","archived":false,"fork":false,"pushed_at":"2025-05-14T10:23:22.000Z","size":12550,"stargazers_count":158,"open_issues_count":11,"forks_count":44,"subscribers_count":42,"default_branch":"master","last_synced_at":"2025-05-14T17:08:20.218Z","etag":null,"topics":["hacktoberfest"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/image-rs.png","metadata":{"files":{"readme":"README.md","changelog":"Changes.md","contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2015-05-29T14:18:52.000Z","updated_at":"2025-05-14T10:23:28.000Z","dependencies_parsed_at":"2023-01-14T22:45:24.877Z","dependency_job_id":"5fc6a974-1f77-40f1-8330-d416650ce282","html_url":"https://github.com/image-rs/image-gif","commit_stats":{"total_commits":252,"total_committers":35,"mean_commits":7.2,"dds":0.6349206349206349,"last_synced_commit":"51ea9b0bf334b918bd24751812ea49c3bf1152f8"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/image-rs%2Fimage-gif","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/image-rs%2Fimage-gif/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/image-rs%2Fimage-gif/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/image-rs%2Fimage-gif/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/image-rs","download_url":"https://codeload.github.com/image-rs/image-gif/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254190395,"owners_count":22029632,"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-08-09T14:03:24.594Z","updated_at":"2025-05-14T17:09:07.496Z","avatar_url":"https://github.com/image-rs.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# GIF en- and decoding library [![Build Status](https://github.com/image-rs/image-gif/workflows/Rust%20CI/badge.svg)](https://github.com/image-rs/image-gif/actions)\n\nGIF en- and decoder written in Rust ([API Documentation](https://docs.rs/gif/)).\n\n# GIF encoding and decoding library\n\nThis library provides all functions necessary to de- and encode GIF files. \n\n## High level interface\n\nThe high level interface consists of the two types\n[`Encoder`](https://docs.rs/gif/*/gif/struct.Encoder.html) and [`Decoder`](https://docs.rs/gif/*/gif/struct.Decoder.html).\n\n### Decoding GIF files\n\n```rust\n// Open the file\nuse std::fs::File;\nlet input = File::open(\"tests/samples/sample_1.gif\").unwrap();\n// Configure the decoder such that it will expand the image to RGBA.\nlet mut options = gif::DecodeOptions::new();\noptions.set_color_output(gif::ColorOutput::RGBA);\n// Read the file header\nlet mut decoder = options.read_info(input).unwrap();\nwhile let Some(frame) = decoder.read_next_frame().unwrap() {\n    // Process every frame\n}\n```\n\n### Encoding GIF files\n\nThe encoder can be used to save simple computer generated images:\n\n```rust\nuse gif::{Frame, Encoder, Repeat};\nuse std::fs::File;\nuse std::borrow::Cow;\n\nlet color_map = \u0026[0xFF, 0xFF, 0xFF, 0, 0, 0];\nlet (width, height) = (6, 6);\nlet beacon_states = [[\n    0, 0, 0, 0, 0, 0,\n    0, 1, 1, 0, 0, 0,\n    0, 1, 1, 0, 0, 0,\n    0, 0, 0, 1, 1, 0,\n    0, 0, 0, 1, 1, 0,\n    0, 0, 0, 0, 0, 0,\n], [\n    0, 0, 0, 0, 0, 0,\n    0, 1, 1, 0, 0, 0,\n    0, 1, 0, 0, 0, 0,\n    0, 0, 0, 0, 1, 0,\n    0, 0, 0, 1, 1, 0,\n    0, 0, 0, 0, 0, 0,\n]];\nlet mut image = File::create(\"target/beacon.gif\").unwrap();\nlet mut encoder = Encoder::new(\u0026mut image, width, height, color_map).unwrap();\nencoder.set_repeat(Repeat::Infinite).unwrap();\nfor state in \u0026beacon_states {\n    let mut frame = Frame::default();\n    frame.width = width;\n    frame.height = height;\n    frame.buffer = Cow::Borrowed(\u0026*state);\n    encoder.write_frame(\u0026frame).unwrap();\n}\n```\n\n[`Frame::from_*`](https://docs.rs/gif/*/gif/struct.Frame.html) can be used to convert a true color image to a paletted\nimage with a maximum of 256 colors:\n\n```rust\nuse std::fs::File;\n\n// Get pixel data from some source\nlet mut pixels: Vec\u003cu8\u003e = vec![0; 30_000];\n// Create frame from data\nlet frame = gif::Frame::from_rgb(100, 100, \u0026mut *pixels);\n// Create encoder\nlet mut image = File::create(\"target/indexed_color.gif\").unwrap();\nlet mut encoder = gif::Encoder::new(\u0026mut image, frame.width, frame.height, \u0026[]).unwrap();\n// Write frame to file\nencoder.write_frame(\u0026frame).unwrap();\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimage-rs%2Fimage-gif","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimage-rs%2Fimage-gif","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimage-rs%2Fimage-gif/lists"}