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.ge tData().getHeig ht() is: 494
And thus this error is returned:
java.awt.image. RasterFormatExc eption: (y + height) is outside raster
at
sun.awt.image.I ntegerInterleav edRaster.create WritableChild(I ntegerInterleav e
dRaster.java:45 3)
at java.awt.image. BufferedImage.g etSubimage(Buff eredImage.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.
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.ge tData().getHeig ht() is: 494
And thus this error is returned:
java.awt.image. RasterFormatExc eption: (y + height) is outside raster
at
sun.awt.image.I ntegerInterleav edRaster.create WritableChild(I ntegerInterleav e
dRaster.java:45 3)
at java.awt.image. BufferedImage.g etSubimage(Buff eredImage.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.