如何将两个文件夹中的图像与imagemagick合并在一起? [英] How can I merge images from two folders into a together side-by-side with imagemagick?
本文介绍了如何将两个文件夹中的图像与imagemagick合并在一起?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有两个文件夹A and B
,其中的图像文件具有相应的名称.
I have two folders, A and B
, with image files that have corresponding names.
例如,每个文件都包含标记为01.png, 02.png, 03.png, etc
的文件.
For example, each contain files labelled 01.png, 02.png, 03.png, etc
.
如何合并相应的文件,以便我拥有包含所有合并照片的第三个folder C
,以便两个原件并排放置.
How can I merge the corresponding files such that I have a third folder C
that contains all merged photos so that both of the originals are side by side.
如果这有任何改变,我在Linux
上.
I am on Linux
, if that changes anything.
推荐答案
我离电脑不远,无法进行彻底测试,但这对我来说似乎最简单:
I am not near a computer to thoroughly test, but this seems easiest to me:
#!/bin/bash
# Goto directory A
cd A
# For each file "f" in A
for f in *.png; do
# Append corresponding file from B and write to AB
convert "$f" ../B/"$f" +append ../AB/"$f"
done
或使用 GNU Parallel 一次完成所有操作!
Or use GNU Parallel and do them all at once!
cd A
parallel convert {} ../B/{} +append AB/{} ::: *.png
这篇关于如何将两个文件夹中的图像与imagemagick合并在一起?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文