Coder Social home page Coder Social logo

swift-gif's Introduction

GIF Coder for Swift

Build

A lightweight LZW encoder and decoder for animated GIFs written in pure Swift, thus running on any platform, including Linux.

Example

// Create a new GIF
var gif = GIF(width: 300, height: 300)

// Add some frames for the animation
for i in 0..<20 {
    let image = try CairoImage(pngFilePath: "frame\(i).png")
    gif.frames.append(.init(image: image, delayTime: 100))
}

// Encode the GIF to a byte buffer
let data = try gif.encoded()

System Dependencies

swift-gif's People

Contributors

fwcd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

swift-gif's Issues

Remove FFI include workaround

# Workaround for FFI modulemap redefinition error, see
# - https://github.com/orgs/Homebrew/discussions/4025
# - https://github.com/tauri-apps/tauri/issues/1150#issuecomment-768310979
- name: Remove duplicate FFI headers (macOS)
if: runner.os == 'macOS'
run: find "/Library/Developer/CommandLineTools/SDKs" -name "MacOSX*.sdk" -type d -depth 1 -exec bash -c '[ -d {}/usr/include/ffi ] && sudo mv {}/usr/include/ffi{,.backup}' \;

We should either remove this now and build with a snapshot toolchain or wait for Swift 5.10 and then remove it.

See fwcd/d2#138 for details.

Multicore encoding

This repository could be much faster by encoding each frame in parallel. This is necessary to achieve acceptable latency in a production renderer, where videos are currently encoded in the GIF (640x640, 20 FPS). I am forking swift-gif and will update this thread when it has been optimized.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.