This is a spritesheet loading class that gets a buffered image, the amount of tiles in the x and y directions and then splits the image into it's subimages and puts it into an appropriately sized array. Problem is, I start getting a rasterformatexception halfway through the first row, saying that (x + width) is outside the raster. Thing is, when I print the amount of space left on the x-axis for the picture, I'm only halfway through loading it. I've only tested it with a single spritesheet that is sized at 192x128. Every time I've looked at the class, everything seems in order. It runs fine for the first four, I'm even able to display the images it successfully loads (Albeit anything after the first image contains all the previous images).
I figure I must be leaving something out, since I'm new to using a BufferedImage, having used only ImageIcons before. So anyone with some more experience have a modification to the code that could help me out? Appreciate any help.
Edit: Ooops this version is the wrong one. Going to put the right one up in a sec.
Edit 2: Updated.