I read separated images from animated gif and I need just make change with them in frames[i]
and then set them back to file and save with writer as new file.
File file = new File("gif1.gif");
ImageReader reader = ImageIO.getImageReadersBySuffix("GIF").next();
ImageInputStream in = ImageIO.createImageInputStream(file);
reader.setInput(in);
File output = new File("k.gif");
ImageWriter writer = ImageIO.getImageWritersBySuffix("GIF").next();
ImageOutputStream out = ImageIO.createImageOutputStream(file);
writer.setOutput(out);
int numImages = reader.getNumImages(true);
BufferedImage[] frames = new BufferedImage[pocetObrazku];
for (int i = 0; i < numImages; i++)
{
BufferedImage image = reader.read(i);
frames[i] = reader.read(i);
}
I'll be glad for any help.
Tanks @StanislavL for link (https://community.oracle.com/thread/1264385) in comment, it was really helpful. There is my solution: