rewrite the script from windows to linux
Posted: 2019-10-13T13:13:49-07:00
please help rewrite the script from windows to linux. ImageMagick 6.9.10-23
Code: Select all
@Echo Off
Setlocal
color 0a
set "Source=%~dp0"
cd /d "%~dp0"
if not exist ".\*.jpg" (
echo.
echo FAILED! Files *.jpg not found.
echo.
pause
endlocal & exit
) else (
echo.
echo Compress all JPG in a Directory:
echo %Source%
if not exist Compressed mkdir Compressed
for %%i in (*.jpg) do (
convert ^
-quality 88 ^
-filter Lanczos ^
-sampling-factor 4:4:4 ^
-define jpeg:dct-method=float ^
"%%i" ^
-thumbnail 400x ^
+write ".\Compressed\%%~ni-w400.webp" ^
".\Compressed\%%~ni-w400.jpg"
echo JPG and WebP 400px done!
)
)
echo.
echo JPG and WebP done!
echo.
pause
endlocal & exit