As a non-java programmer a managed to rewrite a existing appstore java action to resize an image within a given width and height keeping its aspect ratio. If the original image has a different aspect ratio, the top/bottom or left/right side are equally padded and a 'black' background is shown. The question is how to change the background color ? Code snippet: BufferedImage dstImage = new BufferedImage(cropWidth, cropHeight, BufferedImage.TYPE_INT_RGB); dstImage.getGraphics().drawImage(img, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, null);
BufferedImage b_img = ...
Graphics2D graphics = b_img.createGraphics();
graphics.setPaint ( new Color ( r, g, b ) );
graphics.fillRect ( 0, 0, b_img.getWidth(), b_img.getHeight() );
Chris de Gelder
You may be better off asking pure java questions at http://stackoverflow.com/ which is what the Mendix forum concept is based on but this is a place for general programming questions.