如何使用JpegTran递归处理所有图像,并覆盖它们,在使用Windows目录? [英] How to use JpegTran to recursively process all images, overwriting them, in a directory using Windows?

查看:509
本文介绍了如何使用JpegTran递归处理所有图像,并覆盖它们,在使用Windows目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在我有,我用它来处理我的图片下面的批处理文件:

Right now I have the following batch file that I use to process my images:

@echo none 
cd %1 
md "%~1\ProcessedJPEGS"
for %%i in (*.jpg) do "C:\Program Files\Image Optimization\jpegtran.exe" -optimize -progressive -copy none "%%i" "%~1\ProcessedJPEGS\%%i" 
move /Y "%~1\ProcessedJPEGS\*.*" "%~1" 
rd "%~1\ProcessedJPEGS" 
pause

正如你所看到的,这是不理想,但我的技能是可笑的最好,所以我在这里需要一些帮助:)

As you can see, this is not ideal but my skills are laughable at best so I need some help here :)

我要完成的任务是运行这个批目录递归处理所有图像和覆盖它们。

What I want to accomplish is to run this batch in a directory and process all images recursively and overwrite them.

在此先感谢,
Arky

Thanks in advance, Arky

推荐答案

基于命令行,这应该从当前文件夹及以下处理所有JPG文件。测试它的样本组文件/文件夹,以确保它为你工作。

Based upon your command line, this should process all JPG files from the current folder and below. Test it on a sample set of files/folders to be sure it works for you.

@echo none 
for /f "delims=" %%a in ('dir "*.jpg" /b /s /a-d') do (
echo processing "%%a"
"C:\Program Files\Image Optimization\jpegtran.exe" -optimize -progressive -copy none "%%a" "%%a.tmp"
move /Y "%%a.tmp" "%%a" >nul
)
pause

这篇关于如何使用JpegTran递归处理所有图像,并覆盖它们,在使用Windows目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆