public static BufferedImage concatenateImages(final List<BufferedImage> imgCollection,
		final int width, final int height, final int imageType,
		final Direction concatenationDirection)
	{
		final BufferedImage img = new BufferedImage(width, height, imageType);
		int x = 0;
		int y = 0;
		for (final BufferedImage bi : imgCollection)
		{
			final boolean imageDrawn = img.createGraphics().drawImage(bi, x, y, null);
			if (!imageDrawn)
			{
				throw new RuntimeException("BufferedImage could not be drawn:" + bi.toString());
			}
			if (concatenationDirection.equals(Direction.vertical))
			{
				y += bi.getHeight();
			}
			else
			{
				x += bi.getWidth();
			}
		}
		return img;
	}
public static BufferedImage concatenateImages ( final List < BufferedImage > imgCollection , final int width , final int height , final int imageType , final Direction concatenationDirection ) { final BufferedImage img = new BufferedImage ( width , height , imageType ) ; int x = 0 ; int y = 0 ; for ( final BufferedImage bi : imgCollection ) { final boolean imageDrawn = img . createGraphics ( ) . drawImage ( bi , x , y , null ) ; if ( ! imageDrawn ) { throw new RuntimeException ( "BufferedImage could not be drawn:" + bi . toString ( ) ) ; } if ( concatenationDirection . equals ( Direction . vertical ) ) { y += bi . getHeight ( ) ; } else { x += bi . getWidth ( ) ; } } return img ; }
Concatenate the given list of BufferedImage objects to one image and returns the concatenated
BufferedImage object.

@param imgCollection
the BufferedImage collection
@param width
the width of the image that will be returned.
@param height
the height of the image that will be returned.
@param imageType
type of the created image
@param concatenationDirection
the direction of the concatenation.
@return the buffered image