MattS
MattS

Reputation: 1711

How to create true color animated GIF from a list of BufferedImage in Java?

I had a good experience with GifSequenceWriter, however it seems it does not generate true color GIF animations, but is limited to a 256 colors palette. I have a list of frames which a large variance of the color spaces, and I need a true color GIF animation.

What is the best way to achieve this, without external software?

Upvotes: 0

Views: 659

Answers (1)

Ashwanth Kumar
Ashwanth Kumar

Reputation: 677

Based on Wikipedia it does seem like it's possible

A GIF image can include multiple image blocks, each of which can have its own 256-color palette, and the blocks can be tiled to create a complete image.

GitSequenceWriter uses javax.imageio.ImageIO which internally seems to be using com.sun.imageio.plugins.gif.GIFImageWriter. But the GIFImageWriter instance in atleast Oracle JDK8 Installation looks like you can't have more than 8 bits to store the color palette, which restricts the number of colors to 256. You should be able to see that yourself in your Java IDE.

Upvotes: 1

Related Questions