Page 1 of 1

rewrite the script from windows to linux

Posted: 2019-10-13T13:13:49-07:00
by caho
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


Re: rewrite the script from windows to linux

Posted: 2019-10-14T11:38:58-07:00
by caho
help, please!

Re: rewrite the script from windows to linux

Posted: 2019-10-18T21:17:33-07:00
by ferdnyc
caho wrote:
2019-10-13T13:13:49-07:00
please help rewrite the script from windows to linux. ImageMagick 6.9.10-23
The thing is, despite the fact that it uses the `convert` command, your question really isn't about ImageMagick at all — the ImageMagick part will be virtually the same whether you're on Linux or Windows. Your question is really about converting from DOS to Bash command shell scripting, and would be more appropriate for a site that covers that topic, such as the Unix & Linux StackExchange.

Re: rewrite the script from windows to linux

Posted: 2019-10-19T06:51:24-07:00
by caho
ferdnyc wrote:
2019-10-18T21:17:33-07:00
caho wrote:
2019-10-13T13:13:49-07:00
please help rewrite the script from windows to linux. ImageMagick 6.9.10-23
The thing is, despite the fact that it uses the `convert` command, your question really isn't about ImageMagick at all — the ImageMagick part will be virtually the same whether you're on Linux or Windows. Your question is really about converting from DOS to Bash command shell scripting, and would be more appropriate for a site that covers that topic, such as the Unix & Linux StackExchange.
Thank you!