Best way to concatenate multiple images
What is the best way (based on performance) to concatenate multiple gif-files?
We have several small gif files (256x256px) and want to, as fast as possible, allow a client to to request a large image based on width and height and deliver the result as one image containing multiple small gifs.
The way we are doing it today is:
1. Create a new BufferedImage with requested width and height.
2. Fetch all small gifs (reading from file)
3. Get the graphics object for the created BufferedImage and write each gif at the correct x/y co-ordinate using g.drawImage(...)
4. Writing the response with ImageIO.write(the created bufferd image)
Is this the best way? I have a feeling that it's not. The performance is not acceptable. Any suggestions for a better solution?