使用ImageMagick平铺不同纵横比的图像而无间隙

时间:2018-07-12 08:08:19

标签: bash imagemagick image-manipulation montage imagemagick-montage

我希望能够以一种看起来不错的方式将不同纵横比的图像平铺在一起,并尽可能避免图像之间的空白。

到目前为止,我所做的是使用一个脚本重命名所有图像,该脚本将图像名称更改为宽高比,这使ImageMagick首先平铺了最窄的图像:

enter image description here

for i in *.jpg;
    do mv "$i" $(printf '%.4f' $(echo "scale=4;" $(identify -format "%w" "$i") "/" $(identify -format "%h" "$i") | bc))"$i";
done

然后我运行ImageMagick:

montage -mode concatenate -tile 6x -geometry 250x+10+20 -background black *.jpg out.jpg

哪个给我这样的东西:

enter image description here

不幸的是,我想要这样的东西,即纵横比较小和较大的图像之间没有太多垂直空间:

enter image description here

有人有什么想法吗?

0 个答案:

没有答案
相关问题