Best way to concatenate multiple images

You are here:

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?

Reply viewing options

JAI provides an operation called "Mosaic" that does something
similar. As far as performance, though, I have no idea how it
will improve or hurt performance...

> -----Original Message-----
> From: jai-imageio@javadesktop.org
> [mailto:jai-imageio@javadesktop.org]
> Sent: Thursday, August 14, 2008 10:43 AM
> To: interest@jai-imageio.dev.java.net
> Subject: [JAI-IMAGEIO] Best way to concatenate multiple images
>
> Hi,
>
> 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?
> [Message sent by forum member 'phosphora' (phosphora)]
>
> http://forums.java.net/jive/thread.jspa?messageID=293334
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
> For additional commands, e-mail:
> interest-help@jai-imageio.dev.java.net
>
>