简体   繁体   中英

How to get sub image from buffered image

We can get a sub image from BufferedImage using getSubimage(int,int,int,int) , but my problem is I want to get exact subimage(rectangle image) by passing double values as width and height . Is there any alternative for that?

cast the double values to int.

getSubImage((int)x, (int)y, (int)width, (int)height);

and as @camickr mentioned The internal cells will still be represented by integer pixel values. If each cell is 5 pixels square. The first cell starts at (0, 0), the second cell starts at (5, 0) etc...

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