Giter Site home page Giter Site logo

pl-imageio's Introduction

Welcome to pygifsicle documentation!

When creating a GIF using imageio the resulting images can get quite heavy, as the created GIF is not optimized. This can be useful when the elaboration process for the GIF is not finished yet (for instance if some elaboration on specific frames stills need to happen), but it can be an issue when the process is finished and the GIF is unexpectedly big.

GIF files can be compressed in several ways, the most common one method (the one used here) is saving just the differences between the following frames. In this example, we apply the described method to a given GIF my_gif using pygifsicle, a porting of the general-purpose GIF editing command-line library gifsicle.

How do I install this package?

As usual, just download it using pip:

pip install pygifsicle

While running the installation, on MacOS the setup will automatically install gifsicle using [Brew](https://brew.sh/).

On Linux you will need to install gifsicle using apt-get as follows:

sudo apt-get install gifsicle

On Windows you will need to download and install the [correct port of the library](https://eternallybored.org/misc/gifsicle/) for your OS.

Usage examples

The library is currently pretty plain: it offers a wrapper to gifsicle and a method to optimize gifs, wrapping the options for gifsicle.

Optimizing a gif

To optimize a gif, use the following:

from pygifsicle import optimize
optimize("path_to_my_gif.gif")

General wrapper

To run gifsicle from Python use the following:

from pygifsicle import gifsicle
gifsicle(
    sources=["list.gif", "of.gif", "gifs.gif"], # or a single_file.gif
    destination="destination.gif" # or just omit it and will use the first source provided.
    optimize=False, # Whetever to add the optimize flag of not
    colors=256, # Number of colors t use
    options=["--verbose"] # Options to use.
)

pl-imageio's People

Contributors

viresh89 avatar roberto-velazquez avatar

Watchers

Máirín Duffy avatar Christopher Tate avatar

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.