views:

26

answers:

1

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 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 ?

A: 

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.

Will Hamilton