windows - 调整图像大小的批处理脚本

标签 windows shell batch-file jpeg image-resizing

<分区>

我正在寻找一些帮助来编写批处理脚本来调整一堆 .jpg 图像的大小。

我对批处理脚本没有太多经验。但是这个任务将在 Windows 机器上执行,所以我认为批处理脚本可能是一个不错的方法。

我总是有兴趣听到替代的想法和方法,或者被告知我没有想到的元素。

下面我列出了脚本的基本步骤/需求:

1) The images are located in a folder & are all(or should be) 500 x
500.

2) I need copy & past the images to a new folder, where they will be
resized to 250 x 250.

3) I then need to repeat step 2 but this time resize to 125 x 125.

最佳答案

一旦安装 ImageMagick for Windows , 你可以使用 magick command-line tool ,例如

magick.exe mogrify -resize 250x250 -path 250x250/ *.png *.jpg
magick.exe mogrify -resize 125x125 -path 125x125/ *.png *.jpg

注意:确保您的 magick.exe 命令在您的 PATH 系统变量中,并且您指向现有的或创建的目标文件夹(例如 mkdir 250x250/125x125/ 在上面的例子中)。

对于 Linux/Ubuntu,请参阅:How to easily resize images via command-line?

关于windows - 调整图像大小的批处理脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40456998/

相关文章:

c - ShellExecute 挂起模式

windows - 当我将中文字符从 Oracle 表单导出到 Excel 时,它们不再是中文了

linux - Bash 脚本 - Grep/Awk 输出作为另一个脚本的输入

shell - 如何使用 'split'命令

batch-file - 使用批处理脚本查找和替换多个文件中的字符串

Python openpyxl load_workbook 错误 : TypeError (NoneType not Iterable) and ValueError (Max. 值为 180)

c++ - WIn64 内存映射文件和锁定页面

python - 针对本地文件的 Scrapy shell

Windows Batch - 检查一个命令变量是否出现在另一个命令变量中

windows - 嵌套文件 : path and extension filter