I have an array of buffered images and I want to create a gif with them. I also want to be able to specify the delay between the the images. Is there anything in the java api which would be able to provide this? I haven't been able to find anything
Asked
Active
Viewed 3,611 times
4
-
Your question would be clearer if you changed "gif" to "animated gif" in both your question's opening sentence and in its title. – VGR Sep 16 '13 at 10:13
-
I have seen answers to similar questions but I don't believe any of them sufficiently answer the question – d.bech Sep 16 '13 at 12:44
1 Answers
0
You can try the AnimatedGifEncoder code here :
http://www.java2s.com/Code/Java/2D-Graphics-GUI/AnimatedGifEncoder.htm
The question has been asked a lot :
How can I create animated gif in Java?
Creating animated GIF with ImageIO?
EDIT: And even here : https://forums.oracle.com/thread/1264385
-
2
-
I don't think Java SE provide, in standard, the feature you request : "Create an animated gif from buffered images". You will have to hand code a minimum. – superbob Sep 16 '13 at 14:10
-
1@Gilligan94, I agree with you; many people are providing links to other StackOverflow questions or to various other pages, but none of those provide a working ImageIO-based solution. It's unfortunate that this question was closed, as I did some research and found that it can indeed be done with pure ImageIO: Use `ImageWriter.writeToSequence` for each frame, set the delay in each frame's IIOMetadata, and set the repeat count in the first frame's IIOMetadata. – VGR Sep 16 '13 at 23:16
-
@VGR thanks a lot, I find stack exchange has this problem, in fact most reputation/points based support sites do. People are quite to attack you for asking a question that has been asked before no matter how poorly the previous answers were or how different your question is. it's very dissapointing – d.bech Sep 17 '13 at 15:44
-
Didn't know of `ImageWriter.writeToSequence` before @VGR mentioned it. Not easy to find actually, sorry ... – superbob Sep 17 '13 at 19:36