Skip to content

Instantly share code, notes, and snippets.

@matijagrcic
Created November 18, 2016 18:28
Show Gist options
  • Save matijagrcic/c28319b22e2ffffad366c3e00ae7b5aa to your computer and use it in GitHub Desktop.
Save matijagrcic/c28319b22e2ffffad366c3e00ae7b5aa to your computer and use it in GitHub Desktop.
Batch convert webp to png
#Download dwebp (WebP decoder tool) https://developers.google.com/speed/webp/download
#Run
for %f in (*.webp) do dwebp.exe "%f" -o "%~nf.png"
@spenceryonce
Copy link

little batch file I made for the community here:
https://gist.github.com/spenceryonce/e849800e7d7fcbb8645431f7f8abaa81

image

@spenceryonce
Copy link

is there a way to remove the original files automatically?

for %%f in (*.webp) do (
    dwebp.exe -o "%%~nf.png" "%%f"
    del "%%f"
)
@echo off
setlocal

REM Convert all WEBP files to PNG and then delete the WEBP files
for %%f in (*.webp) do (
    echo Converting %%f...
    dwebp.exe "%%f" -o "%%~nf.png"
    if errorlevel 1 (
        echo Failed to convert %%f
    ) else (
        del "%%f"
        echo Deleted %%f
    )
)

echo Conversion complete.
pause

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment