I have faced trouble how to find center of an image and write it to different image. Situation is that I have image (for e.g. 800X500) and I need to crop exactly (50X50 or 70X70) center of it with img.getSubimage(x, y, w, h).
Sizes will be different every time for new image.
How could I calculate X and Y to get 50X50 subImage from the image center?
Thanks in advance.
img.getSubimage(x, y, w, h) - X and Y are not coordinates of center. * @param x the X coordinate of the upper-left corner of the * specified rectangular region * @param y the Y coordinate of the upper-left corner of the * specified rectangular region