Batch Converting Image Files: Difference between revisions

From Littledamien Wiki
Jump to navigation Jump to search
(Created page with "== `ffmpeg` == Use `ffmpeg`. If `ffmpeg` is not available on the command line, install with `brew install ffmpeg`. == Batch convert `webp` to `jpg` == <syntaxhighlight lang=bash> $ for i in *.webp; do ffmpeg -i "$i" "{i%.webp}.jpg"; done </syntaxhighlight> == Batch convert `png` to `jpg` and scaling images proportionally == The `scale=1024:-1` tells ffmpeg to scale the images to 1024 pixels wide. The height will be scaled proportionally. To scale to a consistent h...")
(No difference)

Revision as of 17:15, 26 April 2022

ffmpeg

Use ffmpeg.

If ffmpeg is not available on the command line, install with brew install ffmpeg.

Batch convert webp to jpg

$ for i in *.webp; do ffmpeg -i "$i" "{i%.webp}.jpg"; done

Batch convert png to jpg and scaling images proportionally

The scale=1024:-1 tells ffmpeg to scale the images to 1024 pixels wide. The height will be scaled proportionally. To scale to a consistent height of 800 pixels, scale=-1:800.

$ for i in *.png; do ffmpeg -i "$i" -vf scale=1024:-1 "converted/${i%.*}.jpg"; done