In my program,I am producing a png from a panel,but I want to get rid of the bounding box of this panel and to开发者_JS百科 be more focused to the object in the panel.To do so, I want to get rid of the peripheral parts of png, and produce only the center of it.How can i do that ?
Assuming that you already have your image loaded into a BufferedImage (which seems to be the case), this code will crop the image from (x,y) to (width,height).
image = image.getSubimage(x, y, width, height);
Then save as normal.
精彩评论