How to resize all JPGs in a folder to PNGs with a maximum width using FFmpeg?

FFmpeg is not only for converting videos, you know? I’ll go straight to the point, here’s how I use it.

This one command will get all JPGs in a folder, convert to PNGs and downscale it if it’s more than 512px width:

for i in *.jpg; do ffmpeg -y -i "$i" -vf "scale='min(512,iw)':-1" -sws_flags bilinear "${i%.*}.png"; done


Did you know that I made an in-browser image converter, where you can convert your images without uploading them anywhere? Try it out and let me know what you think. It's free.

Leave a Comment

Your email address will not be published. Required fields are marked *