@echo off setlocal EnableExtensions EnableDelayedExpansion if "%~1"=="" goto usage if "%~2"=="" goto usage set "SRC=%~1" set "OUT=%~2" if not exist "%SRC%\" goto no_src where magick >nul 2>nul if errorlevel 1 goto no_magick if not exist "%OUT%\" mkdir "%OUT%" set /a COUNT=0 set /a FAIL=0 for %%E in (png bmp tif tiff) do ( for %%F in ("%SRC%\*.%%E") do ( if exist "%%~fF" ( set "TARGET=%OUT%\%%~nF.jpg" if exist "!TARGET!" ( echo Skip: %%~nxF ) else ( magick "%%~fF" -auto-orient -strip -quality 90 "!TARGET!" if errorlevel 1 ( echo Failed: %%~nxF set /a FAIL+=1 ) else ( echo Done: %%~nxF set /a COUNT+=1 ) ) ) ) ) echo Converted: %COUNT% Failed: %FAIL% exit /b 0 :usage echo Usage: %~nx0 "source_folder" "output_folder" exit /b 2 :no_src echo Source folder not found: %SRC% exit /b 2 :no_magick echo ImageMagick not found. Install it with: winget install ImageMagick.ImageMagick exit /b 2