GithubHelp home page GithubHelp logo

cerus / jgif Goto Github PK

View Code? Open in Web Editor NEW
5.0 0.0 1.0 18 KB

A little gif editing library for java based on animated-gif-lib-for-java by rtyley.

Java 100.00%
gifimage java gif gif-animation gif-library animated-gif

jgif's Introduction

JGif

JGif is a little gif editing library based on animated-gif-lib-for-java by rtyley.

Usage

  1. Implement this library in your project
  2. Create a GifImage object
  3. (Optional) Load a gif with GifImage#loadFrom(File)
  4. Edit your gif, add frames etc
  5. Save your gif to a file with GifImage#setOutputFile(File) and GifImage#save()

Maven

<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>
	
<dependencies>
    <dependency>
        <groupId>com.github.RealCerus</groupId>
        <artifactId>JGif</artifactId>
        <version>1.0.0</version>
    </dependency>
</dependencies>

Example

public class GifTest {
    public static void main(String[] args) {
        GifImage image = new GifImage();
        image.setOutputFile(new File("./output/output.gif"));
        try {
            image.loadFrom(new File("./my_gif.gif"));
        } catch (FileNotFoundException e) {
            e.printStackTrace();
            return;
        }

        for(int i = 0; i < image.getFrames().size(); i++){
            BufferedImage frame = image.getFrame(i);
            Graphics graphics = frame.getGraphics();
            graphics.setColor(Color.CYAN);
            graphics.drawString("FRAME "+i, 50, 50);
            graphics.dispose();
            image.setFrame(i, frame);
        }

        image.reverseFrames();

        image.save();
    }
}

Output:
Output

jgif's People

Contributors

cerus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Forkers

meimingle

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.