I am doing one application in Java and I want to do this:
I have a BufferedImage
with a large image loaded and I want to assign a part of it to another BufferedImage
.
Let's say
BufferedImage2 = BufferedImage1.GetWindow(From x1 y1 to x2 y2);
BufferedImage2
will be just a small part of the greater BufferedImage1
.
You could try BufferedImage.getSubimage()
int width = x2 - x1;
int height = y2 - y1;
BufferedImage bufferedImage2 = bufferedImage1.getSubimage(x1, y1, width, height);