Is there any way to cut an image up into a sequence of squares.


GreenfootImage bigImage = new GreenfootImage("bigImageName"); int w=bigImage.getWidth(), h=bigImage.getHeight(); int numImagesAcross=a=2, numImagesDown=d=2; GreenfootImage[][] smallImages = new GreenfootImage[a][d]; for(int x=0; x<a; x++) for(int y=0; y<d; y++) { smallImages[x][y]=new GreenfootImage(w/a, h/d); smallImages[x][y].drawImage(bigImage, -x*w/a, -y*h/d); }