Skip to content

Instantly share code, notes, and snippets.

@blockworks
Created March 2, 2021 08:08
Show Gist options
  • Save blockworks/105ef3e26d32a872528fea3536898ff9 to your computer and use it in GitHub Desktop.
Save blockworks/105ef3e26d32a872528fea3536898ff9 to your computer and use it in GitHub Desktop.
cwebpを使ったbatファイル
@echo off
cd /d %~dp1
for %%q in (%*) do (
echo TARGET FILE : %%~nxq
REM *** PNG FILE ***
if %%~xq == .png (
call :OPTIMIZE_WEBP "%%~nxq"
)
if %%~xq == .PNG (
call :OPTIMIZE_WEBP "%%~nxq"
)
REM *** JPEG FILE ***
if %%~xq == .jpg (
call :OPTIMIZE_WEBP "%%~nxq"
)
if %%~xq == .JPG (
call :OPTIMIZE_WEBP "%%~nxq"
)
echo.
)
PAUSE
exit /b
REM *** SUBROUTINE ***
:OPTIMIZE_WEBP
cwebp.exe -q 75 -metadata icc -sharp_yuv -o %~n1.webp %1
del /F quantized_%1
exit /b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment