rewrite the script from windows to linux

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
caho
Posts: 13
Joined: 2019-06-18T00:29:40-07:00
Authentication code: 1152

rewrite the script from windows to linux

Post 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

caho
Posts: 13
Joined: 2019-06-18T00:29:40-07:00
Authentication code: 1152

Re: rewrite the script from windows to linux

Post by caho »

help, please!
ferdnyc
Posts: 3
Joined: 2014-03-30T10:03:00-07:00
Authentication code: 6789

Re: rewrite the script from windows to linux

Post 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.
caho
Posts: 13
Joined: 2019-06-18T00:29:40-07:00
Authentication code: 1152

Re: rewrite the script from windows to linux

Post 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!
Post Reply