简体   繁体   中英

get rid of some parts of png in java

在我的程序中,我正在从面板中生成png,但是我想摆脱该面板的边界框,而将注意力更多地集中在面板中的对象上。为此,我想摆脱外围设备png的部分,仅产生其中心。我该怎么做?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM