Convert images to AVIF recursively
bulk convert jpg to avif linux | convert images to avif command line | generate avif images for website | avifenc recursive conversion | avifenc | avif | images | findCaution: This command changes the system. Understand what it does before you run it.
find /var/www/vhosts/example.com/httpdocs/wp-content/uploads -type f \( -iname '*.jpg' -o -iname '*.jpeg' -o -iname '*.png' \) -exec sh -c 'for f; do [ -e "$f.avif" ] || avifenc -s 6 "$f" "$f.avif" >/dev/null; done' sh {} +Creates a file bild.jpg.avif next to each JPEG and PNG and skips images that were already converted. AVIF often compresses even better than WebP, but encoding is considerably slower. A lower speed value gives slightly better compression at the cost of more CPU time.
Note: avifenc is part of the libavif-bin package. With many images the run can take a long time and put noticeable load on the server, so it is best started with nice.
Open question before approval: Paketname libavif-bin auf Debian 12 und Ubuntu 24.04 bestätigen. Die Option -q für die Qualität gibt es erst ab libavif 1.0 (Ubuntu 24.04), Debian 12 hat 0.11, daher hier nur -s (Geschwindigkeit 0 bis 10).
Also searched as
- bulk convert jpg to avif linux
- convert images to avif command line
- generate avif images for website
- avifenc recursive conversion