创建一个您将写入的大图像。根据您想要的行数和列数制定其维度。
BufferedImage result = new BufferedImage(
width, height, //work these out
BufferedImage.TYPE_INT_RGB);
Graphics g = result.getGraphics();
现在循环遍历您的图像并绘制它们:
for(String image : images){
BufferedImage bi = ImageIO.read(new File(image));
g.drawImage(bi, x, y, null);
x += 256;
if(x > result.getWidth()){
x = 0;
y += bi.getHeight();
}
}
最后写出来:
ImageIO.write(result,"png",new File("result.png"));