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

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

@Syralix115
Copy link

done and all the images disappeared...

@yungztrunks
Copy link

always keep a backup of your images

@Syralix115
Copy link

just used a program i got instead. was easy to get all the images back due to the original way i got them using yt-dlp. still confused why it deleted them all though.

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