java - 如何在Java中将多张图像合并为一张图像(垂直平铺的图像)
问题描述
我有一个图像列表。我想将它们合并到一个图像中,以便它们在新图像中垂直排列。研究向我指出了这段代码,但努力调整它们
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();
}
}
解决方案
推荐阅读
- mysql - 如何将表的值转换为左连接结果表中的字段
- coq - 围绕“elim 限制”的问题
- node.js - 有时 Elasticsearch 在将日志保存到 Elasticsearch 时抛出异常
- java - Java AVL 树指针操作
- css - 是否可以使用 css 代码在 chrome 中复制禁用 CSSOM View Scroll Coordinates 标志的效果?
- c# - MSBuild 和 VS2019 中的外部定义条件编译
- awk - 对列进行分类并计算列中的警告数
- mapping - 我可以得到 Temi 机器人地图文件吗?
- sql - 在 postgresql12 上使用连接查询每个值的最后一个值
- java - Java 泛型:从泛型对象中检索类型