Benchmarking Webp format (WIP)

Bensuperpc February 16, 2025 [Software] #Features #Benchmarking #avif #webp #png #jpegxl #Format

Introduction

Webp is a image format created by Google in early 2010's, in this article, we will benchmark it against others lossless formats like avif, png, jpegxl.

The benchmark is done using the PNG format as input, and the output formats are Webp, Avif, and JpegXL.

Setup

SpecificationValue
CPUAMD Ryzen 7 5700X 8c16t (3.4 GHz / 4.6 GHz)
GPUNVIDIA GeForce RTX 3060 Ti 8GB GDDR6
RAM64GB DDR4 3200MHz
OSManjaro
CompilerGCC 15.2.1
cwebp1.6.0
avifenc1.3.0
cjxl0.11.1
ffmpeg8.0.1
Docker Imagedocker.io/bensuperpc/multimedia:1.0.0-archlinux-base-20260101

Lossless compression

The dataset for the lossless benchmark is:

The PNG to Webp lossless compression command is:

cwebp -quiet -metadata all -lossless -exact -z <Compression> <Input> -o <Output>

The options are:

For PNG to Avif lossless compression:

avifenc --jobs 1 --lossless --speed <Compression> --codec <codec> <Input> --output <Output>

The options are:

For PNG to JPGXL lossless compression:

cjxl --num_threads 1 --quiet --effort <Compression> --distance 0.0 --brotli_effort 11 <Input> <Output>

The options are:

For the final command, we use GNU Parallel to speed up the process (for Webp):

time find . -iname "*.png" -type f -print0 | parallel --jobs 16 --null cwebp -quiet -metadata all -lossless -exact -z 9 {} -o {.}.webp

The CMD to get the size of the output files is:

find . -type f -iname "*.webp" -printf "%s\n" | awk '{sum+=$1} END {printf "%.2f MiB\n", sum/1024/1024}'

Where {1} is the compression level from 0 to 9.

Results

For Ciphar-10:

FormatCompressionSize (MiB)Ratio (%)Time (s)
png-100.0-
webp0298
webp1299
webp2300
webp3302
webp4295
webp5291
webp6295
webp7293
webp8293
webp9103.29286
jpegxl1
jpegxl2
jpegxl3
jpegxl4
jpegxl5
jpegxl6
jpegxl7
jpegxl8
jpegxl9

Cleanup

find . -type f -name "*.webp" -delete

Sources