Quality
The quality parameter controls the compression ratio of the output image, allowing you to balance file size and visual quality.
Parameter Details
- Parameter:
quality - Units: Number
- Range: 0 to 100
- Default: 85
How It Works
The quality parameter dictates the compression ratio of the output image. The higher the number, the better the quality but larger the file size. Lower quality significantly reduces the image size but also results in worse overall quality and artifacting if pushed too far.
Examples
High Quality (80)
?quality=80Results in a 117KB image with excellent visual quality.
Medium Quality (50)
?quality=50Results in an 81KB image with good visual quality and moderate compression.
Low Quality (10)
?quality=10Results in a 35KB image with significant compression artifacts but very small file size.
Default Quality Behavior
If you do not specify quality in query parameters, there are multiple fallback options:
Smart Image Optimization Settings
If you have configured Smart Image Optimization in your settings, those parameters will dictate the default quality for user requests. For example, desktop requests might get a default quality of 80 while mobile requests get 70.
System Default
When no Smart Image Optimization is configured and no quality parameter is provided, the quality defaults to 85.
Priority Order
The quality setting follows this priority order:
- Query parameter - Highest priority
- Smart Optimization setting - Medium priority
- System default (85) - Lowest priority
Best Practices
- 90-100: Use for high-quality images where file size is less important
- 70-85: Recommended for most web images (good balance of quality and size)
- 50-70: Suitable for thumbnails or when bandwidth is limited
- Below 50: Only use when extremely small file sizes are required
Usage Examples
# High quality for hero images
https://cdn.filezen.dev/image.jpg?quality=95
# Balanced quality for general content
https://cdn.filezen.dev/image.jpg?quality=80
# Compressed for thumbnails
https://cdn.filezen.dev/image.jpg?quality=60