开发者

get rid of some parts of png in java

开发者 https://www.devze.com 2023-01-07 15:50 出处:网络
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 t

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号