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; for y to rows: for x to columns: { if (i >= l(tiles)) break; BufferedImage tile = tiles.get(i++); copyBufferedImage(tile, img, x*tw, y*th); } ret img; }