I have a 2D boolean array that is a segmented image and looks like this:
000000000000000000
000000011110000000
000001110111100000
000001111110100000
000000111101100000
000000111011000000
And I want to crop the picture and resize it to a specific size like this:
00111100
11101111
11111101
01111011
01110110
I have tried to use a BufferedImage to save it and use getSubimage() but I can't get the boundaries right...
I also have tried this method where I have the core of the buffered image:
int Width = buffer.getWidth();
int Height = buffer.getHeight();
int x1= (int) (core.getX()) - (Width/2);
int y1= (int)(core.getY()) - (Height/2);
buffer = buffer.getSubimage(x1, y1, Width, Height);
How can I crop it and resize it?