Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to batch convert JPEG images with jpegtran on Windows

Is it possible to batch convert a folder of JPEG images using jpegtran on Windows?
I normally use the following command for one file, but I'm not sure how to apply it to an entire directory of JPEG files:

jpegtran -copy none -optimize a.jpg b.jpg

Thank you.

like image 680
HartleySan Avatar asked Aug 12 '15 04:08

HartleySan


People also ask

How do I convert JPG to PNG in Mass?

Step 1: Click on “Load a Photo”, then select the image you want to convert. Step 2: Click on “Convert & Save”. Then “Save as PNG”. Step 3: The file will then get saved in a new folder on your phone.


1 Answers

  1. Download jpegtran
  2. Put jpegtran.exe in C:/Program Files/Image Optimization (create the folder if it doesn’t exist).
  3. Open your text editor, then copy & paste code below.
  4. Save it as optimize.bat, then put the file in C:/Program Files/Image Optimization.
  5. Run optimize.bat (Run as administrator) to optimize all images in C:/Program Files/Image Optimization (change path in line 3 if you want to optimize another folder).

    @echo off echo Optimizing Images... cd "C:\Program Files\Image Optimization" forfiles /s /m *.jpg /c "cmd /c @\"C:\Program Files\Image Optimization\jpegtran.exe\" -copy none -optimize -outfile @file @file" echo. & echo Process done! pause

The procedure to optimize all images in a folder is described in the following link. I think it might help you.

Optimize All Images in a Folder

like image 118
Smrity Avatar answered Sep 19 '22 04:09

Smrity