我有一张图片列表。我想将它们合并为一个图像,以便它们在新图像中垂直排列。研究向我指出了这段代码,但努力使它们对齐
BufferedImage result = new BufferedImage(
width, height, //work these out
BufferedImage.TYPE_INT_RGB);
Graphics g = result.getGraphics();
for(String image : imgFiles){
BufferedImage bi = ImageIO.read(new File(image));
g.drawImage(bi, x, y, null);
x += 256;
if(x > result.getWidth()){
x = 0;
y += bi.getHeight();
}
}