0
votes

I'm looking for a function that could process animated gif image to write text on top of it.

The working solution is probably provided by Gif4j lib, but I'm looking for open-source solution or advice how to implement it on my own.

How can I put text on a gif and save it as a new gif in Java?

1
Graphics.drawString() but not sure if it would work for an animated image. - Nikolay Kuznetsov
This is creating an animated gif using ImageIO. You could just draw the text on the offscreen images before you create the gif - Clark

1 Answers

3
votes

You need to:

  1. Split the animation into separate frames.
  2. Write the text on each frame. For examples see answers like these (the first is more closely related, but the second source does the same, and is simpler).
  3. Construct the frames into a new animated GIF. See Create animated GIF using imageio at the OTN, where I discuss the code used in a GIF animation tool.