Combining two images in java? -
in project users uploads picture. times smaller expected.
i'd create default size white(empty) image , place users image(small) @ center of white image. in other words, want cover sides of small image white pixels.
how can java?
i not in java image processing. use buferedimage
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 source image width , height less 50. source image rendered left top , remaining area filled black.
is possible move source image center , fill remaining pixels white color.
any suggestions appreciative.
thanks
did try newimage.getgraphics().translate((25-srcimage.getwidth()/2), (25-srcimage.getheight()/2)); ?
Comments
Post a Comment