How to configure and use Jpegtran with Windows

I am a Windows user trying to get started with jpegtran and have not found a way to actually access the program. All the questions that I found begin on the command line, but when I try to duplicate the commands, I get errors such as:

After viewing this question :

I tried to execute these commands:

@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 

I get the error "%% a at this time was not expected."

My question is how to configure the folder structure for images, jpegtran.exe and command line so that this command is executed?

+4
source share
2 answers

Your solution above looks like the correct format - but it is a batch file and you cannot paste it into the command line. Save the code in a text file, call it runjpg.bat and run it in the folder with some jpg files for testing. (Avoid calling the batch file with the same name as the command)

+5
source

[Invalid information deleted]

EDIT:

Sorry, DO NOT REALLY saw the question!

This fixed batch will be, for each jpg file found in the current directory and subdirectories:

  • create optimized file (suffix .tmp)
  • replace the source file with the created tmp file.

The only requirement that I see here is that you must have jpegtran.exe in the folder C:\Program Files\Image Optimization !

0
source

Source: https://habr.com/ru/post/1499126/


All Articles