static BufferedImage tilesToImage(L tiles, int columns) { if (empty(tiles)) null; int rows = idiv_ceil(l(tiles), columns); int tw = first(tiles).getWidth(), th = first(tiles).getHeight(); int w = tw*columns, h = th*rows; BufferedImage img = newBufferedImage(w, h); int i = 0, yy = 0; for y to rows: { int xx = 0; for x to columns: { if (i >= l(tiles)) break; BufferedImage tile = tiles.get(i++); copyBufferedImage(tile, img, xx, yy); xx += tile.getWidth(); th = tile.getHeight(); } yy += th; } ret img; }