All Projects → image-rs → Image Gif

image-rs / Image Gif

Licence: other
GIF en- and decoder

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to Image Gif

Gulp Wp Pot
Gulp plugin to generate pot file for WordPress plugins and themes
Stars: ✭ 67 (-1.47%)
Mutual labels:  hacktoberfest
Laravel Ecommerce
AvoRed an Open Source Laravel Shopping Cart
Stars: ✭ 1,151 (+1592.65%)
Mutual labels:  hacktoberfest
Openwisp Network Topology
Network topology collector and visualizer. Collects network topology data from dynamic mesh routing protocols or other popular networking software like OpenVPN, allows to visualize the network graph, save daily snapshots that can be viewed in the future and more.
Stars: ✭ 67 (-1.47%)
Mutual labels:  hacktoberfest
Mathexecutor
Simple math expresions parser and calculator
Stars: ✭ 67 (-1.47%)
Mutual labels:  hacktoberfest
Youtubeexplode.converter
Muxes and converts videos from YoutubeExplode
Stars: ✭ 68 (+0%)
Mutual labels:  hacktoberfest
Adminlte
Pi-hole Dashboard for stats and more
Stars: ✭ 1,155 (+1598.53%)
Mutual labels:  hacktoberfest
Ex mustang
✨ A simple, clueless bot
Stars: ✭ 67 (-1.47%)
Mutual labels:  hacktoberfest
Escpos Printer Db
Database of ESC/POS thermal receipt printers
Stars: ✭ 68 (+0%)
Mutual labels:  hacktoberfest
Ideogram
Insert emoji anywhere in elementary OS, even in non-native apps
Stars: ✭ 68 (+0%)
Mutual labels:  hacktoberfest
Vue Lunar Calendar
A vue component for lunar calendar.
Stars: ✭ 68 (+0%)
Mutual labels:  hacktoberfest
Multipletab
Multiple Tab Handler, Provides feature to close multiple tabs.
Stars: ✭ 67 (-1.47%)
Mutual labels:  hacktoberfest
Notify Py
💬 | A simple Python Module for sending cross-platform desktop notifications on Windows, macOS and Linux
Stars: ✭ 68 (+0%)
Mutual labels:  hacktoberfest
Talisman
By hooking into the pre-push hook provided by Git, Talisman validates the outgoing changeset for things that look suspicious - such as authorization tokens and private keys.
Stars: ✭ 1,155 (+1598.53%)
Mutual labels:  hacktoberfest
Yii2 Smarty
Yii 2 Smarty Extension.
Stars: ✭ 67 (-1.47%)
Mutual labels:  hacktoberfest
Elmyr
A utility to make Kotlin/Java tests random yet reproducible
Stars: ✭ 68 (+0%)
Mutual labels:  hacktoberfest
Activity
⚡️ Activity app for Nextcloud
Stars: ✭ 67 (-1.47%)
Mutual labels:  hacktoberfest
Alpakka
Alpakka is a Reactive Enterprise Integration library for Java and Scala, based on Reactive Streams and Akka.
Stars: ✭ 1,154 (+1597.06%)
Mutual labels:  hacktoberfest
Solid
Liquid template engine in Elixir
Stars: ✭ 68 (+0%)
Mutual labels:  hacktoberfest
Ratp Api Rest
This project turnkey is distributed as a middleware to expose RATP realtime data as REST resources
Stars: ✭ 68 (+0%)
Mutual labels:  hacktoberfest
Brawlstats
(A)sync python wrapper for the Brawl Stars API
Stars: ✭ 68 (+0%)
Mutual labels:  hacktoberfest

GIF en- and decoding library Build Status

GIF en- and decoder written in Rust (API Documentation).

GIF encoding and decoding library

This library provides all functions necessary to de- and encode GIF files.

High level interface

The high level interface consists of the two types Encoder and Decoder.

Decoding GIF files

// Open the file
use std::fs::File;
let input = File::open("tests/samples/sample_1.gif").unwrap();
// Configure the decoder such that it will expand the image to RGBA.
let mut options = gif::DecodeOptions::new();
options.set_color_output(gif::ColorOutput::RGBA);
// Read the file header
let mut decoder = options.read_info(input).unwrap();
while let Some(frame) = decoder.read_next_frame().unwrap() {
    // Process every frame
}

Encoding GIF files

The encoder can be used to save simple computer generated images:

use gif::{Frame, Encoder, Repeat};
use std::fs::File;
use std::borrow::Cow;

let color_map = &[0xFF, 0xFF, 0xFF, 0, 0, 0];
let (width, height) = (6, 6);
let beacon_states = [[
    0, 0, 0, 0, 0, 0,
    0, 1, 1, 0, 0, 0,
    0, 1, 1, 0, 0, 0,
    0, 0, 0, 1, 1, 0,
    0, 0, 0, 1, 1, 0,
    0, 0, 0, 0, 0, 0,
], [
    0, 0, 0, 0, 0, 0,
    0, 1, 1, 0, 0, 0,
    0, 1, 0, 0, 0, 0,
    0, 0, 0, 0, 1, 0,
    0, 0, 0, 1, 1, 0,
    0, 0, 0, 0, 0, 0,
]];
let mut image = File::create("target/beacon.gif").unwrap();
let mut encoder = Encoder::new(&mut image, width, height, color_map).unwrap();
encoder.set_repeat(Repeat::Infinite).unwrap();
for state in &beacon_states {
    let mut frame = Frame::default();
    frame.width = width;
    frame.height = height;
    frame.buffer = Cow::Borrowed(&*state);
    encoder.write_frame(&frame).unwrap();
}

Frame::from_* can be used to convert a true color image to a paletted image with a maximum of 256 colors:

use std::fs::File;

// Get pixel data from some source
let mut pixels: Vec<u8> = vec![0; 30_000];
// Create frame from data
let frame = gif::Frame::from_rgb(100, 100, &mut *pixels);
// Create encoder
let mut image = File::create("target/indexed_color.gif").unwrap();
let mut encoder = gif::Encoder::new(&mut image, frame.width, frame.height, &[]).unwrap();
// Write frame to file
encoder.write_frame(&frame).unwrap();
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].