ImageMagick's WebP image format accepts a plethora of encoding options to fine-tune compression, file size, and visual quality. Explore the default parameters, recommended scenario presets, and complete property reference below.
When encoding WebP images without explicit parameters, ImageMagick initializes the following default values:
quality = 75alpha-filtering = 1alpha-quality = 100autofilter = 0filter-sharpness = 0filter-strength = 60lossless = 0method = 4pass = 1preprocessing = 0segments = 4sns-strength = 50target-psnr = 0target-size = 0- ImageMagick sets
pass=6iftarget-psnrortarget-sizeare specified. - If
qualityis specified, ImageMagick setsnear_losslessto the same value (note thatnear_losslesscannot be set directly). - If
qualityis set to100or greater, ImageMagick setslossless=1. You can override this using:-quality 100 -define webp:lossless=false.
Depending on the visual characteristics of your source images, consider applying these optimized configuration defines:
Digital Pictures
Portraits, indoor shots, and close-up photography.
-define webp:sns-strength=80
-define webp:filter-sharpness=4
-define webp:filter-strength=35
-define webp:preprocessing=0
Outdoor Photographs
Landscapes and natural lighting environments.
-define webp:sns-strength=80
-define webp:filter-sharpness=3
-define webp:filter-strength=30
-define webp:preprocessing=2
Hand & Line Drawings
Illustrations featuring high-contrast details.
-define webp:sns-strength=25
-define webp:filter-sharpness=6
-define webp:filter-strength=10
Small Colorful Images
Icons, UI elements, and vibrant graphics.
-define webp:sns-strength=0
-define webp:filter-strength=0
-define webp:preprocessing=0
Text Images
Documents, screenshots, and text-heavy graphics.
-define webp:sns-strength=0
-define webp:filter-strength=0
-define webp:preprocessing=0
-define webp:segments=2
Here is a complete list of WebP encoding options available for fine-tuning via ImageMagick:
| Option | Description |
|---|---|
alpha-compression=value |
Resamp the alpha plane: 0 = none, 1 = compressed. |
alpha-filtering=value |
Predictive filtering method for alpha plane: 0=none, 1=fast, 2=best. |
alpha-quality=value |
Compression value for alpha between 0 and 100. Lossless compression uses 100; lower values result in lossy compression (default: 100). |
exact=true, false |
Preserve RGB values in transparent areas. Disabled by default to improve compressibility. |
auto-filter=true, false |
When enabled, spends additional time optimizing filtering strength to reach a well-balanced quality. |
emulate-jpeg-size=true, false |
Return compression similar to JPEG but with reduced degradation. |
filter-sharpness=value |
Filter sharpness level. |
filter-strength=value |
Strength of the deblocking filter, between 0 (off) and 100 (maximum). Higher values increase smoothing. Typical values range from 20 to 50. |
filter-type=value |
Filter type: 0 = simple, 1 = strong. |
image-hint=default, photo, picture, graph |
Hint regarding the source image type. |
lossless=true, false |
Encode the image without any quality loss. |
low-memory=true, false |
Reduce encoder memory consumption. |
method=value |
Compression method controlling the tradeoff between encoding speed, file size, and quality (0 to 6, default: 4). Higher values inspect more possibilities. |
preprocessing=value |
Preprocessing mode: 0 = none, 1 = segment-smooth, 2 = pseudo-random dithering. |
partitions=value |
Progressive decoding partitions: choose 0 to 3. |
partition-limit=value |
Quality degradation limit: 0 for no degradation, 100 for maximum degradation. |
pass=value |
Maximum number of passes to reach target compression size or PSNR. |
segments=value |
Maximum number of segments to use, ranging from 1 to 4. |
show-compressed=true, false |
Display compressed output metrics. |
sns-strength=value |
Amplitude of spatial noise shaping (SNS) algorithms used to distribute bits efficiently (0 to 100, default: 80). |
target-size=value |
Target size in bytes for the compressed output. The compressor performs multiple passes to approach this goal. |
target-psnr=value |
Desired minimal peak signal-to-noise ratio distortion. |
thread-level=value |
Enable multi-threaded encoding: 0 = disabled, 1 = enabled. |
use-sharp-yuv=value |
Use sharp and precise RGB-to-YUV conversion when needed. |