static RGBImage mergeImagePartsVertically(RGBImage img, L rects) { RGB spaceColor = new RGB(0.9f); int spacing = imageMergeSpacing(); if (l(rects) == 0) ret new RGBImage(1, 1, spaceColor); int h = intSum(rects, "h")+(l(rects)-1)*spacing, w = intMax(rects, "w"); RGBImage out = new RGBImage(w, h, spaceColor); int y = 0; for i over rects: { Rect r = rects.get(i); int x = (w-r.w)/2; copyRGBImage(img, r.x, r.y, out, x, y, r.w, r.h); y += r.h + spacing; } ret out; }