Skip to content

Instantly share code, notes, and snippets.

@patrickgalbraith
Last active February 5, 2019 06:24
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save patrickgalbraith/58374a2c16b6b319684fdb588d40be30 to your computer and use it in GitHub Desktop.
Save patrickgalbraith/58374a2c16b6b319684fdb588d40be30 to your computer and use it in GitHub Desktop.
Resize all images in a folder
@echo off
cls
set "resolution=1080"
for /f "tokens=* delims=" %%G in ('dir /A-D /B *.jpg') do (
ffmpeg -y -i "%%~G" -vf "scale='min(%resolution%,iw)':min'(%resolution%,ih)':force_original_aspect_ratio=decrease" "%%~G"
)
for /f "tokens=* delims=" %%G in ('dir /A-D /B *.png') do (
ffmpeg -y -i "%%~G" -vf "scale='min(%resolution%,iw)':min'(%resolution%,ih)':force_original_aspect_ratio=decrease" "%%~G"
)
@patrickgalbraith
Copy link
Author

This will overwrite all images in a folder with the resized version so make sure you have a backup!

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