Here you can find the source of split(int w, int h, BufferedImage src)
public static BufferedImage[] split(int w, int h, BufferedImage src)
//package com.java2s; //License from project: Apache License import java.awt.image.BufferedImage; public class Main { public static BufferedImage[] split(int w, int h, BufferedImage src) { int xs = src.getWidth() / w; int ys = src.getHeight() / h; BufferedImage[] result = new BufferedImage[xs * ys]; int i = 0; for (int y = 0; y < ys; y++) { for (int x = 0; x < xs; x++) { result[i++] = src.getSubimage(x * w, y * h, w, h); }// w w w. j av a 2s . c o m } return result; } }