In my project users uploads picture. Some times it is smaller than expected.
I'd like to create a default size white(empty) image and place users image(small) at the center of the white image. In other words, i want to cover all sides of a small image with white pixels.
How can i do it with java?
I am not good in java image processing.
But i use BuferedImage to expand uploaded image.
BufferedImage newImage = new BufferedImage(50, 50, BufferedImage.TYPE_INT_RGB);
newImage.getGraphics().drawImage(srcImage, 0, 0, srcImage.getWidth(), srcImage.getHeight(), null);
The above code, fills black color if the source image width and height is less than 50. The source image is rendered from left top and remaining area is filled by black.
Is it possible to move the source image to center and fill the remaining pixels with white color.
Any suggestions will be appreciative.
Thanks