AVIF & HDR / Wide Color Gamut: Use Cases and Techniques

What AVIF HDR and Wide Color Gamut Actually Mean
AVIF is a modern image format that compresses better than JPEG or PNG while maintaining quality. When you add HDR (High Dynamic Range) and wide color gamut support, you unlock capabilities that traditional web images simply can't match.
Here's what these terms really mean:
HDR means your images can show a wider range of brightness. Shadows have more detail. Bright areas don't blow out to pure white. A sunset can show both the dark landscape and bright sky without losing detail in either.
Wide Color Gamut means more colors. Standard sRGB (the web default) shows about 35% of colors humans can see. Display P3 shows about 50%. Rec. 2020 covers even more. This matters for vibrant reds, deep blues, and accurate skin tones.
Feature | Standard JPEG | AVIF with HDR/WCG |
---|---|---|
Color Space | sRGB (limited) | Display P3, Rec. 2020 |
Bit Depth | 8-bit (256 levels) | 10-bit or 12-bit (1024+ levels) |
Dynamic Range | SDR (standard) | HDR (wider brightness) |
File Size | Baseline | 20-50% smaller at same quality |
Why This Matters for Real Projects
You might think this is overkill. It's not. Modern phones and displays already support these features. Your users see washed-out colors and clipped highlights if you're still using standard JPEG.
The benefits are concrete:
- File sizes drop by 30-50% compared to JPEG at the same quality level
- Images look dramatically better on iPhone 12+, modern Android phones, and MacBooks
- Product photos show true colors, reducing returns from color mismatch
- Photography portfolios display the full range you captured
- Page load speeds improve despite higher quality visuals
Browser and Device Support in 2025
AVIF support has grown significantly. As of early 2025, here's what works:
Desktop Browsers
- Chrome 85+ (full AVIF support, HDR on compatible displays)
- Edge 121+ (Windows HDR support)
- Firefox 93+ (basic AVIF, improving HDR support)
- Safari 16+ (macOS Ventura and later, Display P3 wide gamut)
Mobile Devices
- iPhone 12 and newer (HDR10, Display P3)
- Android 12+ devices with HDR displays (varies by manufacturer)
- Samsung Galaxy S21+ and newer (HDR10+)
- iPad Pro models with Liquid Retina XDR
Check current support at Can I Use AVIF for the latest compatibility data.
Use Cases That Actually Benefit from AVIF HDR
E-commerce Product Photography
Color accuracy determines whether customers buy or return items. A red dress that looks orange on screen leads to returns. Wide color gamut AVIF shows the actual product color.
Jewelry, makeup, and fashion benefit most. Metallic finishes, gemstones, and fabric textures show detail that standard images flatten. You reduce customer complaints and increase confidence.
Implementation for E-commerce
- Shoot in RAW with color calibration targets
- Process images in Display P3 color space
- Export as 10-bit AVIF with color profile embedded
- Provide JPEG fallback for older browsers
Photography Portfolios and Art Galleries
Photographers capture images in 12-bit or 14-bit RAW. Converting to 8-bit JPEG throws away 95% of that tonal information. HDR AVIF preserves what you actually photographed.
Landscape photography gains the most. Sunsets, night shots, and high-contrast scenes maintain shadow and highlight detail. Your portfolio shows your actual work, not a compressed compromise.
Gaming and Digital Art
Game developers render in HDR. Character art uses vibrant colors beyond sRGB. Converting to standard formats for marketing materials dulls the impact.
AVIF HDR screenshots and promotional art match what players see in-game. This honesty builds trust and excitement.
Real Estate and Architectural Photography
Interior shots struggle with windows. Standard images either blow out windows or crush interior shadows. HDR captures both the view outside and room details.
Property listings with HDR images get more engagement. Buyers see accurate lighting and can judge spaces better.
Medical and Scientific Imaging
Accurate color representation matters for diagnostics and research. Tissue samples, microscopy, and diagnostic images require precision.
10-bit color depth shows subtle variations that 8-bit images hide. This isn't about aesthetics—it's about accuracy.
Creating AVIF HDR Images: Step-by-Step Techniques
Method 1: Using libavif Command Line Tools
The most control comes from libavif, the reference encoder. Install it through your package manager or build from source at GitHub libavif repository.
Basic HDR Conversion
avifenc --min 0 --max 63 --minalpha 0 --maxalpha 63 -s 4 --jobs 8 --depth 10 input.png output.avif
This command creates a 10-bit AVIF with good compression. The parameters mean:
--min 0 --max 63
: Quality range (0 is lossless, 63 is lowest quality)-s 4
: Speed setting (0-10, lower is slower but better quality)--depth 10
: 10-bit color depth for HDR--jobs 8
: Use 8 CPU threads for faster encoding
Wide Color Gamut with Display P3
avifenc --min 0 --max 40 -s 4 --depth 10 --nclx 12/1/6 input.tiff output.avif
The --nclx 12/1/6
flag specifies Display P3 color space. Your source image must be in Display P3 for this to work correctly.
Method 2: ImageMagick with AVIF Support
ImageMagick 7.1+ includes AVIF encoding. It's easier for batch processing but offers less control.
magick convert input.png -depth 10 -colorspace DisplayP3 -quality 85 output.avif
For HDR tone mapping from standard images:
magick convert input.jpg -colorspace RGB -depth 10 -auto-gamma output.avif
Method 3: Photoshop and Professional Tools
Adobe Photoshop 2024 and later support AVIF export through plugins. Affinity Photo also supports AVIF natively.
Workflow in Photoshop:
- Edit your image in 16-bit mode
- Convert to Display P3 color profile (Edit > Convert to Profile)
- Install the AVIF export plugin
- Export as AVIF with 10-bit depth and quality 80-90
- Embed the color profile in export settings
Method 4: Online Converters for Quick Testing
For testing without installing software, use Squoosh by Google. It runs in your browser and supports AVIF HDR.
Upload your image, select AVIF on the right panel, adjust quality, and download. It's not suitable for production but perfect for understanding quality/size tradeoffs.
Optimizing AVIF HDR for Web Performance
Finding the Right Quality Settings
Quality 80-85 typically gives the best balance. Higher settings create large files with minimal visible improvement. Lower settings introduce artifacts.
Quality Setting | File Size (relative) | Best For |
---|---|---|
90-100 | 100% | Medical imaging, archival |
80-85 | 40-50% | Hero images, product photos |
70-75 | 30-35% | Gallery thumbnails, backgrounds |
Below 70 | 20-25% | Not recommended (visible artifacts) |
Responsive Images with srcset
Generate multiple sizes and let browsers pick the right one. Here's the HTML pattern:
<picture>
<source type="image/avif" srcset="photo-800.avif 800w, photo-1200.avif 1200w, photo-2000.avif 2000w">
<source type="image/jpeg" srcset="photo-800.jpg 800w, photo-1200.jpg 1200w, photo-2000.jpg 2000w">
<img src="photo-1200.jpg" alt="Descriptive alt text" loading="lazy">
</picture>
This gives you AVIF for supported browsers with JPEG fallback. The browser downloads only what it needs.
Lazy Loading and Progressive Rendering
Add loading="lazy"
to images below the fold. Browsers defer loading until users scroll near them.
For hero images, consider a low-quality placeholder that loads instantly while the full image downloads in the background.
Color Management and HDR Tone Mapping
Understanding Color Spaces
Color spaces define which colors are possible. Think of them as paint palettes—some have more colors than others.
- sRGB: The web standard. Every browser understands it. Limited color range.
- Display P3: 25% more colors than sRGB. Standard on modern Apple devices. Good web support.
- Rec. 2020: Future-proof. Twice the colors of sRGB. Limited device support in 2025.
For web use in 2025, target Display P3. It's widely supported and shows dramatic improvement over sRGB.
Converting Between Color Spaces
Converting requires color management software. Don't just assign a profile—convert the actual color values.
In Photoshop: Edit > Convert to Profile > Display P3
In ImageMagick: -colorspace DisplayP3
In libavif: --nclx 12/1/6
(Display P3 parameters)
HDR Tone Mapping from SDR Sources
You can't create true HDR from standard images, but you can preserve more tonal range:
- Start with a high-quality 16-bit source
- Use highlight and shadow recovery to expand dynamic range
- Apply gentle tone curves rather than aggressive S-curves
- Export at 10-bit depth to preserve subtle gradations
This isn't true HDR but looks significantly better than 8-bit JPEG, especially in gradients and shadow areas.
Testing and Validation
Visual Testing on Multiple Devices
Test your AVIF HDR images on actual devices. Colors and brightness vary significantly across displays.
Essential test devices:
- iPhone 12 or newer (HDR10, P3)
- MacBook Pro with Liquid Retina XDR (if available)
- Standard Windows laptop (SDR, sRGB)
- Android phone with OLED display
The goal isn't identical appearance—that's impossible. The goal is good appearance on all devices with extra impact on capable displays.
Technical Validation Tools
Use these tools to verify your AVIF files:
- exiftool: Reads metadata and confirms color profiles
- avifdec: Decodes AVIF to verify it's valid
- Chrome DevTools: Network tab shows actual file sizes and load times
Command to check AVIF metadata:
exiftool -a -G1 image.avif
Common Problems and Solutions
Colors Look Wrong or Washed Out
Cause: Missing or incorrect color profile embedded in the file.
Solution: Explicitly embed the color profile during export. Use --nclx
parameters with libavif or ensure "Embed Color Profile" is checked in your image editor.
File Sizes Are Larger Than Expected
Cause: Quality setting too high or image complexity.
Solution: Reduce quality to 80-85. Use slower encoding speeds (-s 4
or lower) for better compression. Consider reducing image dimensions if web display doesn't require full resolution.
Images Don't Load in Some Browsers
Cause: No fallback image or incorrect MIME type.
Solution: Always provide JPEG fallback in a <picture>
element. Configure your server to send Content-Type: image/avif
header.
HDR Effect Not Visible
Cause: Viewing on SDR display or source wasn't true HDR.
Solution: Test on HDR-capable device. Verify source image has actual dynamic range beyond standard 8-bit. Check that bit depth is 10 or higher.
Server Configuration and Delivery
Setting Correct MIME Types
Servers must send the right content type. Add this to your configuration:
Apache (.htaccess)
AddType image/avif .avif
Nginx
types {
image/avif avif;
}
CDN Configuration
Most modern CDNs support AVIF. Cloudflare, Fastly, and AWS CloudFront handle it automatically. Verify in your CDN settings that AVIF is enabled for image transformation.
Content Negotiation
Serve AVIF to supporting browsers, JPEG to others. This happens automatically with the <picture>
element, but you can also implement server-side negotiation.
Check the Accept
header for image/avif
and serve accordingly. Most frameworks have libraries for this.
Automation and Workflow Integration
Batch Processing Scripts
Process entire directories with a shell script:
#!/bin/bash
for img in *.jpg; do
avifenc --min 0 --max 40 -s 4 --depth 10 --jobs 8 "$img" "${img%.jpg}.avif"
done
This converts all JPEGs in a folder to AVIF with consistent settings.
Build Tool Integration
Integrate AVIF conversion into your build process. For webpack users, add imagemin-avif
. For gulp, use gulp-avif
.
Example webpack configuration:
const ImageMinimizerPlugin = require('image-minimizer-webpack-plugin');
optimization: {
minimizer: [
new ImageMinimizerPlugin({
generator: [{
type: 'asset',
implementation: ImageMinimizerPlugin.imageminGenerate,
options: {
plugins: ['imagemin-avif']
}
}]
})
]
}
CI/CD Pipeline Integration
Add image optimization to your deployment pipeline. GitHub Actions example:
- name: Optimize Images
run: |
npm install -g @squoosh/cli
squoosh-cli --avif '{"quality":85}' ./images/*.jpg
Future-Proofing and Best Practices
Start with the Best Source Material
Garbage in, garbage out applies to images. Shoot in RAW format. Edit in 16-bit. Export to 10-bit AVIF only as the final step.
Maintain your high-quality originals. As display technology improves, you can re-export with even better settings.
Monitor Performance Impact
Track actual page load times and user engagement. AVIF should improve both, but verify with real data.
Use tools like Google Lighthouse to measure performance gains. Compare before and after metrics.
Stay Updated on Browser Support
Browser capabilities improve constantly. Features that are limited today may be standard in six months. Check Can I Use regularly and adjust your approach.
Consider Your Audience
If analytics show 90% of visitors use modern devices, prioritize AVIF HDR. If you have significant traffic from older devices, ensure fallbacks work perfectly.
Geographic location matters too. Some regions have slower adoption of new devices and browsers.
Accessibility Considerations
HDR and wide gamut don't directly affect accessibility, but implementation details do:
- Alt text remains critical: Describe image content regardless of format
- Contrast ratios: HDR can make text overlays harder to read if not careful
- File size matters: Smaller AVIF files help users on slow connections or limited data
- Fallbacks are essential: Don't exclude users with older browsers
Cost-Benefit Analysis
Costs | Benefits |
---|---|
Learning curve for new tools | 30-50% smaller file sizes |
Processing time for conversion | Dramatically better visual quality |
Testing on multiple devices | Faster page load times |
Maintaining fallback images | Better SEO (Core Web Vitals) |
Storage for multiple formats | Competitive advantage in visual quality |
For most modern websites, the benefits clearly outweigh the costs. The initial setup takes time, but the ongoing payoff is substantial.
Real-World Implementation Example
Let's walk through implementing AVIF HDR for a photography portfolio site:
Step 1: Prepare Source Images
- Export from Lightroom in Display P3 color space
- Use TIFF format at 16-bit depth
- Maintain 3000px on the long edge for hero images
Step 2: Generate Multiple Formats and Sizes
#!/bin/bash
sizes=(800 1200 2000)
for img in originals/*.tiff; do
base=$(basename "$img" .tiff)
for size in "${sizes[@]}"; do
# Resize
magick "$img" -resize ${size}x${size}\> "temp-${size}.png"
# Convert to AVIF
avifenc --min 0 --max 40 -s 4 --depth 10 "temp-${size}.png" "avif/${base}-${size}.avif"
# Create JPEG fallback
magick "temp-${size}.png" -quality 85 "jpeg/${base}-${size}.jpg"
done
done
Step 3: Implement Responsive Images
<picture>
<source type="image/avif"
srcset="photo-800.avif 800w, photo-1200.avif 1200w, photo-2000.avif 2000w"
sizes="(max-width: 600px) 100vw, (max-width: 1200px) 80vw, 1200px">
<source type="image/jpeg"
srcset="photo-800.jpg 800w, photo-1200.jpg 1200w, photo-2000.jpg 2000w"
sizes="(max-width: 600px) 100vw, (max-width: 1200px) 80vw, 1200px">
<img src="photo-1200.jpg"
alt="Sunset over mountain range with dramatic clouds"
loading="lazy"
width="1200"
height="800">
</picture>
Step 4: Measure Results
- Compare file sizes: AVIF typically 40-60% smaller
- Test load times with Chrome DevTools
- Verify visual quality on HDR display
- Check Lighthouse scores before and after
Summary: Making the Switch to AVIF HDR
AVIF with HDR and wide color gamut isn't just a format upgrade—it's a fundamental improvement in how images look and perform on the web.
Start here:
- Install libavif or use Squoosh for testing
- Convert your most important images first (hero images, product photos)
- Use Display P3 color space for the best compatibility/quality balance
- Set quality to 80-85 for production use
- Always provide JPEG fallbacks with the picture element
- Test on both HDR and standard displays
The file size savings alone justify the switch. The visual quality improvement on modern devices makes it essential for any site where images matter.
Frequently Asked Questions
Q: Will AVIF HDR images look worse on older displays?
A: No. Browsers automatically tone-map HDR images for standard displays. They'll look as good as standard images, sometimes better due to higher bit depth reducing banding in gradients. The key is providing proper fallbacks for browsers that don't support AVIF at all.
Q: How much does encoding speed matter?
A: For one-time conversions, use the slowest speed setting you can tolerate (speed 0-4 in libavif). This gives the best compression. For automated pipelines processing hundreds of images, speed 6-8 offers a good balance. The quality difference is usually 5-10% file size, not visual quality.
Q: Can I convert animated GIFs to AVIF HDR?
A: Yes. AVIF supports animation and typically compresses 10-20x better than GIF while supporting millions of colors instead of 256. Use avifenc
with the same quality settings. However, note that HDR doesn't benefit animations as much as still images unless you have specific high dynamic range animation content.
Q: What's the best workflow for large image libraries?
A: Process in batches during off-hours. Keep your original high-quality sources separate from web-optimized versions. Use a script to generate AVIF and JPEG versions automatically. Store both formats on your CDN and let the picture element handle delivery. Consider using a service like Cloudinary or imgix that can convert on-the-fly if you have thousands of images.
Q: Should I use AVIF for all images on my site?
A: Not necessarily. Small icons, logos, and simple graphics work fine as SVG or even PNG. Focus AVIF on photographs, product images, and any content where quality and file size matter. UI elements with transparency might still be better as PNG unless file size is critical. Evaluate case by case based on the specific image and its role.
Conclusion
AVIF with HDR and wide color gamut represents the current state of the art in web image delivery. The format delivers smaller files with objectively better quality on modern devices.
Implementation requires upfront work—learning new tools, adjusting workflows, and testing across devices. But the payoff comes quickly. Faster page loads improve SEO and user experience. Better visuals increase engagement and conversions. Smaller files reduce hosting and bandwidth costs.
Start small. Convert your most important images first. Measure the results. Once you see the difference, expanding to your entire image library becomes an obvious choice.
The web is moving toward richer visual experiences. HDR displays are becoming standard, not premium. Wide color gamut is the default on new devices. AVIF gives you the tools to deliver content that matches modern hardware capabilities.
Your images already exist. The cameras and phones that captured them recorded more information than JPEG can show. AVIF HDR finally lets that information reach your users' screens.
The question isn't whether to adopt AVIF HDR—it's how quickly you can implement it.
Additional Resources:
• Jake Archibald's AVIF Deep Dive
• Netflix's AVIF Implementation Case Study
• Web.dev Guide to AVIF Compression
• MDN Web Docs: AVIF Image Format