By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,779 Members | 1,078 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,779 IT Pros & Developers. It's quick & easy.

To all you intelligent Java people...

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.
Jul 17 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.