我如何才能同时调整 300 张图像的大小?

我如何才能同时调整 300 张图像的大小?

我有一个文件夹,里面有大约 300 张图片。我想在另一个文件夹中将它们调整为 800px 宽。我该怎么做?我尝试了一些 ImageMagick 命令。

答案1

对于 GUI,帕奇“一次点击价值千张照片”是这种快速工作的最佳选择。它已经在 Ubuntu 存储库中。

sudo apt-get install phatch

对于高级用户来说,以下是在 shell 中循环文件的示例:

#!/bin/bash

# Configuration
ext="bmp"
count=0
total=0

#loop through all files in the current folder that ends with $ext extension
for i in $(ls *.$ext)
    do
        total=$(($total + 1))

            #replace the 'potrace -s "$i"' with your converting cmd
            #"$i" is the file name
            #it will count +1 if successful
        potrace -s "$i" && count=$(($count + 1))
    done

echo "$count/$total files converted"
#wait
read

此示例转换bmpsvg,我之前为我弟弟编写了此代码,用于将他扫描的漫画/动漫图画转换为矢量形式。在着色之前。

相关内容