P: n/a

I am trying to create a sub image of a bufferedimage which contains a
picture.
I've divided the whole picture up into 80 by 80 pixels which gives me 7 rows
and 6 columns. (there's a bit of wasted picture which I don't care about)
Therefore each y coordinate runs from 0 to 480 in 80 increments (e.g. 7
rows)
The height of the area must be no less than 480+80 which is 560.
When I return the height it tells me that:
currentImage.getData().getHeight() is: 494
And thus this error is returned:
java.awt.image.RasterFormatException: (y + height) is outside raster
at
sun.awt.image.IntegerInterleavedRaster.createWrita bleChild(IntegerInterleave
dRaster.java:453)
at java.awt.image.BufferedImage.getSubimage(BufferedI mage.java:1060)
To calculate the number of columns I did integer division imageHeight/80
which gives 6. If you double division it gives 6.175, therefore there should
be 0.175 rows of which I won't be using.
So my question is: Why does my last row go over the boundry of the origional
image?
Any help appreciated,
Gray.  
Share this question for a faster answer!