Scratch for Java

GifEncoder()

Browser availability: desktop-only.

The encoder behind the desktop's GifRecorder; recording is desktop-only.

Encodes a GIF file consisting of one or more frames.

 Example:
    GifEncoder e = new GifEncoder();
    e.start(outputFileName);
    e.setDelay(1000);   // 1 frame per sec
    e.addFrame(argbPixels, width, height);
    e.finish();

Ported from AnimatedGifEncoder (Kevin Weiner, FM Software, November 2003), with the LZW encoder adapted from Jef Poskanzer's Java port by way of J. M. G. Elliott, and the NeuQuant neural-net quantizer by Anthony Dekker, 1994. Uses only java.base: frames arrive as ARGB int arrays instead of BufferedImages.

Syntax

Java

new GifEncoder()
GifEncoder()

Create Shareable URL

Select Sections