1

My goal is it, to make an API-endpoint, where people can provide a String, that will then be added to a randomly selected gif, which will then be returned.
The text will be provided through a link (query param).

Someone recommended me to look at Convert each animated GIF frame to a separate BufferedImage but I'm not completely sure, if the provided solutions would work, for what I want to achieve.

I already did some endpoints, where I create images depending on certain values, which are returned as bytes[] in a getOutputStream().write(), but those are (obviously) only png-images.

Other things to note are, that I store the gifs, which should be edited, locally on the server and that I use sparkjava, to listen for get actions on the endpoints.

Is the recommended answer in the above question a good solution, or is there a better one?

Andre_601
  • 87
  • 8
  • Conceptually, the linked answer is correct. You need to read in each frame of the GIF, apply the text to it and write the result back out again. Having done it a few times in the past, I can't be bothered to write yet another answer. [This](https://stackoverflow.com/questions/18117283/mirroring-animated-gif-on-load-in-java-imageicon/18117326#18117326) demonstrates reading a GIF, frame by frame, modifying the frame and writing it back to a new GIF – MadProgrammer Oct 22 '18 at 00:38

0 Answers0