static BufferedImage centerImageOnBackground(Color bg, WidthAndHeight size, BufferedImage img) { if (img == null) null; BufferedImage canvas = newBufferedImage(size, bg); drawImageOnImage(img, canvas, (size.w()-img.getWidth())/2, (size.h()-img.getHeight())/2); ret canvas; }