简体   繁体   中英

How to crop image in different shapes

I try to get a subImage from the given image as shown below: 在此处输入图片说明 I know how to crop in rectangular shape like this

image = image.getSubImage(x, y, width, height);

but by using this method it is not possible for me to get different shape image from a given image, if anyone has suggestion can show me. Thanks in advance!

您可以通过Graphics类来完成此操作: http : //docs.oracle.com/javase/tutorial/2d/advanced/clipping.html

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