SlideShare una empresa de Scribd logo
1 de 53
Faster ForwardTM
PUTTING YOUR IMAGES ON A DIET
Guy Podjarny (@guypod)
CTO, Web Experience, Akamai
Everything you wanted to know about image compression… and then some.
Faster ForwardTM
We have an image problem…
Images appear simple
Images seem friendly
Images look like they can’t hurt
But while you weren’t looking…
Images Have Been
Taking over
The World
(wide web)
Faster ForwardTM
Images make up 63-66% of Page Bytes
17%
3%
5%
9%
3%
1054,
63%
Desktop Bytes
Scripts CSS Flash Other HTML Images
23%
5%
0%
1%
5%
552, 6
6%
Mobile Bytes
Scripts CSS Flash Other HTML Images
Faster ForwardTM
Image Byte Increase over last 3 years
It’s not more images,
It’s BIGGER images
2.2x more Image Bytes in 3 years
32% more
bytes
in 1 year
Faster ForwardTM
What is there to optimize with images?
- Today’s focus: Image Compression
- Optimizing image formats & encoding
- There are other ways to optimize images
- Optimize Image Loading
- Optimize Image Delivery
- Responsive Images
- …
Faster ForwardTM
LET’S START AT THE BEGINNING…
Faster ForwardTM
GIF – Graphics Interchange Format
- 27 Years Old (1987)
- 256 Colors
- “Simple” Transparency
- No partial (Alpha) transparency
- Supported Everywhere
- Supports Animation
- Previously Patented
- Patents expired by now
Faster ForwardTM
PNG – Portable Network Graphics
- 18 Years Old (1996)
- Supports 8-32 bit color palettes
- PNG8 and PNG24 Most Common
- Supports Alpha Transparency
- Good browser support
- Certain issues in IE 6-8
- Non-patented
- Supports Animation (MNG)!
- No browser support
Faster ForwardTM
Lossless PNG Compression
- Delta-Filter Encoding
- Write pixels as delta from neighbors
- Compress using LZ77
- Reference past sequences
- Compress using Huffman code
- Identify repeating sequences
- Code popular ones with fewer bytes
= 1,2,3,4,5,
0x20
= 1x25
= 1,2,3,4,5,
(-5,5)x5
Up Delta
Left Delta
Source: Sergey Chikuyonok, Smashing Magazine
Faster ForwardTM
Lossless PNG Optimization
- Delta Filter Optimization
- Per row, choose comparison target: None, Left, Up, Average, Paeth
- Convert from PNG 24 -> 8
- Possibly using multiple PNG 8 layers
- Tune LZ77 distance/length parameters
- Tune Huffman buffer size
- Trade “Alpha” transparency with simple (100%) transparency
- PNG Optimization Tools: PNGCrush, OptiPNG
Faster ForwardTM
JPEG – Joint Photographic Experts Group
- 22 years old (1992)
- Supports RGB Colors (24 bit)
- Supports custom color palettes
- No Transparency Support
- Doable with HTML5 Canvas Hacks
- No Animation Support
- Not impressed…
- It’s a Lossy Format
Faster ForwardTM
JPEG Dominates Page Bytes, But PNG Is Growing
17%
25%
Faster ForwardTM
JPEG Compression - Simplified
1. Divide image into 8x8 pixel blocks
Faster ForwardTM
JPEG Compression - Simplified
1. Divide image into 8x8 pixel blocks
2. Split Luminance & Chrominance
Y Cb Cr
Faster ForwardTM
YCbCr (YUV) Visualization – Grand Tetons
Source:
IE Blog
Faster ForwardTM
Chroma Subsampling
- Chroma diffs are less noticeable
- Subsampling “merges” adjacent pixels
- Most popular is 4:2:2, 4:2:0
- Reduce Chroma bytes by 2x or 4x
- Tools often deduce subsamplling
- Based on quality tier
- Photoshop Example:
- no subsampling for quality 51-100
- 4:2:0 subsamplling for quality 0-50
Source: JPEG For The Horseshoe Crabs
Faster ForwardTM
JPEG Compression - Simplified
1. Divide image into 8x8 pixel blocks
2. Split Luminance & Chrominance
3. Chroma Subsampling
4. Write pixels as ~delta from average
• and round (DCT + Quantization)
Y Cb Cr
Faster ForwardTM
JPEG Compression - Simplified
1. Divide image into 8x8 pixel blocks
2. Split Luminance & Chrominance
3. Chroma Subsampling
4. Write pixels as ~delta from average and
round (DCT + Quantization)
5. Write as line, compress (Huffman)
= -9,-1,0(x62)
Faster ForwardTM
JPEG Compression - Simplified
1. Divide image into 8x8 pixel blocks
2. Split Luminance & Chrominance
3. Chroma Subsampling
4. Write pixels as delta from average
and round (DCT + Quantization)
5. Write as line, compress (Huffman)
Q=10 Q=50 Original
Faster ForwardTM
Original PNG: 574 KB JPEG, Q=90: 105 KB
Faster ForwardTM
Original PNG: 574 KB JPEG, Q=75: 53 KB
Faster ForwardTM
Original PNG: 574 KB JPEG, Q=40: 30 KB
Faster ForwardTM
Original PNG: 574 KB JPEG, Q=20: 18 KB
Faster ForwardTM
Original PNG: 574 KB JPEG, Q=10: 11 KB
Faster ForwardTM
Original PNG: 574 KB JPEG, Q=5: 7 KB
Faster ForwardTM
Lossy Compression – Not for Everyone
GIF, 11 KB
JPEG, Q=80, 8 KB
JPEG, Q=30, 4 KB
Average Color not
representative
PNG, 7 KB
Faster ForwardTM
JPEG Optimization
- Control Quality
- 75-85 tops
- Quality level ≠ percentage
- Tools interpret quality differently
- Tune Huffman Buffer Size
- Use Arithmetic Encoding (vs Huffman)
- Low adoption, no browser support
- Tools: jpegtran, ImageMagick
0
50
100
150
200
250
300
350
0 20 40 60 80 100 120
Quality vs File Size
Faster ForwardTM
JPEG Metadata
120KB
Thumbnail
Faster ForwardTM
JPEG Optimization
- Control Quality
- 75-85 tops, try to go lower
- Tune Huffman Buffer Size
- Remove Metadata
- Tools: jpegtran, ImageMagick
Faster ForwardTM
JPEG Baseline vs. Progressive
Baseline
Progressive
http://www.bookofspeed.com/chapter5.html
Pro-Tip: Configure how blocks are
“interlaced” (The “Coefficient”)
- Controls minimum quality level
- Affects Size
Faster ForwardTM
Baseline vs Progressive – Visual Progress
Baseline
Progressive
Patrick Meenan:
“… Looking at the
Speed Index, we saw
median improvements
of 7% on Cable and
15% on DSL …”
Loading…
Faster ForwardTM
JPEG Baseline vs. Progressive
Baseline
Progressive
http://www.bookofspeed.com/chapter5.html
1 2
0 0
1 0
0 0
3 -1
0 0
1 2 0 0 1 0 0 0 3 -1 0 0
1 1 3 2 0 -1 0 0 0 0 0 0
1 1 3 2 0 -1 EOB
Mo’ zeros, Mo’ compression
Faster ForwardTM
Baseline vs Progressive – File Size
Baseline – Progressive Size for 100,000 JPEGs
Stoyan Stefanov:
Images of size 10K+
likely smaller as
Progressive.
Median delta is 3%,
Up to 10%
common, 250KB gap
extreme.
Progressive Smaller
Baseline Smaller
Faster ForwardTM
Progressive vs Baseline – Current Reality
Ann Robson:
“… In a thousand-image
sample, 92.6% are
baseline …”
Patrick Meenan: “… I crawled all 7 million JPEG images
that were served by the top 300k websites in the May 1st
HTTP Archive crawl and came out with....wait for it.... still
only 7% …”
Faster ForwardTM
Lossless JPEG Optimization
- Control Quality
- 75-85 tops, try to go lower
- Tune Huffman Buffer Size
- Remove Metadata
- Consider (and default to) Progressive over Baseline
- Tune Progressive Scan coefficients
- Tools: jpegtran, ImageMagick, jpegrescan (~1.2% better)
Faster ForwardTM
Retina Images
bg_header_retina.png – 56 KB
bg_header.png –
14KB
1 2
43
• Marketing-speak for 2x pixel ratio (or more)
• 1 CSS pixel = 4 real pixels
• Other ratios are possible (1.5x common)
3X
Faster ForwardTM
JPEG Retina Trick
- Retina images often 3-4x file size
- Regular images are “fuzzy” on Retina
- Double size, Lower Quality =
Sharper Image, Smaller File
- Discovered by Netvlies & Thomas Fuchs
- Popularized by Filament Group
- Not clear WHY it works
- Artifact of tools “Quality” level?
- Higher Memory Usage
- More on that later…
Faster ForwardTM
Lossless JPEG Optimization
- Control Quality
- 75-85 tops, try to go lower
- Tune Huffman Buffer Size
- Remove Metadata
- Consider (and default to) Progressive over Baseline
- Tune Progressive Scan coefficients
- Consider Retina Double-Size-Low-Quality Trick
- Tools: jpegtran, ImageMagick, jpegrescan, ImageOptim
Faster ForwardTM
Got Through JPEG!
Next Up:
Faster ForwardTM
WebP – Web Picture?
- 3 Years Old (2011)
- Pronounced “Weppy”
- Supports Lossless & Lossy Modes
- Very well documented
- See: https://developers.google.com/speed/webp/
- Related VP8 Google Patents “released” by Google
- Other patents licensed by Google for global use
- Nokia still claiming related Patents
Faster ForwardTM
WebP vs PNG
Google:
Lossless WebP 26%-34%
Smaller than PNG
Yoav Weiss:
Lossless WebP 33%-42%
Smaller than PNG
Faster ForwardTM
WebP vs JPEG
Google:
Lossy WebP 25%-
34% Smaller than JPEG
Yoav Weiss:
Lossy WebP 37%
Smaller than PNG
Faster ForwardTM
WebP – Impressed Yet?
- 26% - 42% Smaller than PNG
- 25% - 37% Smaller than JPEG
- Supports Alpha Transparency
- Supports Animation!
- Why did waste time talking
about the other formats?!
23+ 12.1+
Faster ForwardTM
JPEG XR (eXtended Range)
- 4 Years Old (2009)
- Smaller files than JPEG
- A big bigger than WebP
- Patented by Microsoft
- Under “Open Spec Promise”
- Jxrlib has BSD License
- Support: IE 9+ (incl. Mobile)
- Properly works in IE 10+
- Includes IE Mobile
10+
Faster ForwardTM
Similarity Tests
- Formats work differently
- Quality # means different
visual quality per format
- Similarity algorithms help
detect “similar” images
- Across image formats
- Sample algo: DSSIM
Faster ForwardTM
WebP vs JPEG-XR vs Optimized JPEG (Akamai Data)
Nick Doyle (Akamai):
1. WebP & JXR Both better than JPEG.
2. Beware the different Quality scales
Faster ForwardTM
JPEG 2000
- 6-14 Years Old (2000/2008)
- Uses DWT instead of DCT
- Along with other improvements
- ~30% Smaller than JPEG
- Based on initial Akamai research
- Patented, but free to use
- As agreed by ~20 patent-owning org’s
- Support: Safari & Mobile Safari
- iOS 6+, Mac Safari, not Win Safari
Faster ForwardTM
Processing Images Ain’t Easy…
- Images are 60% of bytes - likely <95% of memory usage
- Resized Retina images take up 4x the memory!
- Output pushed to GPU, often through slow Mobile BUS
- GPUs now starting to process YUV – faster with less RAM for JPEGs
- Network time is not the only thing that matters…
Typical Image Decoding Flow (Source: IE Blog):
30 KB
JPG Input
~300 KB
in YUV
(~10 bbp)
1 MB After
Upsampling
(~32 bbp)
RAM:
Often 300-800ms on Mobile
Faster ForwardTM
Mozilla still undecided
- Ran a comparative study: JPEG, JXR, WebP, HEVC-MSP
- Used 4 algorithms to find “comparable” image across formats
- HEVC-MSP deemed best, results inconclusive for others
- Note: Study used PNG’s as source
- Akamai’s studies used “live” website images
0.8
0.9
1
1.1
1.2
1.3
50 55 60 65 70 75 80 85 90 95
Relative File Size, Kodak Image Set, Y-SSIM
JPEG JPEG XR WebP HEVC-MSP
0.5
0.6
0.7
0.8
0.9
1
1.1
50 55 60 65 70 75 80 85 90 95
Relative File Size, Kodak Image Set, RGB-SSIM
JPEG JPEG XR WebP HEVC-MSP
Faster ForwardTM
New Image Formats - Summary
Format Size vs
JPEG
Proggressive Transparency
Support
Hardware
Decoding
Encoder Browser
Support
JPEG N/A N/A No No jpegtran Everybody
WebP -35% -35% Yes No cwebp
JPEG XR -30% N/A
In Spec, not
Browsers
Maybe jxrlib
JPEG 2000 -30% N/A
In Spec, not
Browsers
Maybe OpenJPEG
10+
12.1+4+23+
6+6+
Faster ForwardTM
Faster ForwardTM
When to use which format?
- For tiny images (e.g. 1x1 pixel) use GIF
- PNG-8 practically always smaller
- For most small images, use PNG
- Where possible, prefer JPEG to PNG
- Use WebP/JXR/J2K where possible
- Serve only to supporting clients
- For Animation, use GIF
- Seat back and reap the rewards…
Faster ForwardTM
A PICTURE COSTS A THOUSAND WORDS
Guy Podjarny (@guypod)
CTO, Web Experience, Akamai
Thank You!
Questions?

Más contenido relacionado

Similar a Putting Your Images on a Diet (SmashingConf, 2014)

Preparing images for the Web
Preparing images for the WebPreparing images for the Web
Preparing images for the Websdireland
 
The need for Speed: Advanced #webperf - SEOday 2018
The need for Speed: Advanced #webperf - SEOday 2018The need for Speed: Advanced #webperf - SEOday 2018
The need for Speed: Advanced #webperf - SEOday 2018Bastian Grimm
 
Web Performance Madness - brightonSEO 2018
Web Performance Madness - brightonSEO 2018Web Performance Madness - brightonSEO 2018
Web Performance Madness - brightonSEO 2018Bastian Grimm
 
A holistic approach to web performance
A holistic approach to web performanceA holistic approach to web performance
A holistic approach to web performanceAustin Gil
 
Web Performance: 3 Stages to Success
Web Performance: 3 Stages to SuccessWeb Performance: 3 Stages to Success
Web Performance: 3 Stages to SuccessAustin Gil
 
Voices that matter: High Performance Web Sites
Voices that matter: High Performance Web SitesVoices that matter: High Performance Web Sites
Voices that matter: High Performance Web SitesStoyan Stefanov
 
Photo echance. Problems. Solutions. Ideas
Photo echance. Problems. Solutions. Ideas Photo echance. Problems. Solutions. Ideas
Photo echance. Problems. Solutions. Ideas Andrew Nikishaev
 
Web graphics vector & roaster101
Web graphics  vector & roaster101Web graphics  vector & roaster101
Web graphics vector & roaster101nageswaran987
 
Image optimization and you
Image optimization and youImage optimization and you
Image optimization and youJohannes Siipola
 
Portable Network Graphics (PNG)
Portable Network Graphics (PNG)Portable Network Graphics (PNG)
Portable Network Graphics (PNG)Sarmad Makhdoom
 
Trouble with distribution
Trouble with distributionTrouble with distribution
Trouble with distributionJ On The Beach
 
File types pro forma
File types pro formaFile types pro forma
File types pro formaCam Stannard
 
Images - 7 mistakes (first draft)
Images - 7 mistakes (first draft)Images - 7 mistakes (first draft)
Images - 7 mistakes (first draft)Stoyan Stefanov
 
Altitude London 2018: A hands-on tour of Image Optimisation workshop
Altitude London 2018: A hands-on tour of Image Optimisation workshopAltitude London 2018: A hands-on tour of Image Optimisation workshop
Altitude London 2018: A hands-on tour of Image Optimisation workshopFastly
 
Super speed around the globe - SearchLeeds 2018
Super speed around the globe - SearchLeeds 2018Super speed around the globe - SearchLeeds 2018
Super speed around the globe - SearchLeeds 2018Bastian Grimm
 
SearchLeeds 2018 - Bastian Grimm - Peak Ace - International site speed: Going...
SearchLeeds 2018 - Bastian Grimm - Peak Ace - International site speed: Going...SearchLeeds 2018 - Bastian Grimm - Peak Ace - International site speed: Going...
SearchLeeds 2018 - Bastian Grimm - Peak Ace - International site speed: Going...Branded3
 

Similar a Putting Your Images on a Diet (SmashingConf, 2014) (20)

Preparing images for the Web
Preparing images for the WebPreparing images for the Web
Preparing images for the Web
 
The need for Speed: Advanced #webperf - SEOday 2018
The need for Speed: Advanced #webperf - SEOday 2018The need for Speed: Advanced #webperf - SEOday 2018
The need for Speed: Advanced #webperf - SEOday 2018
 
Web Performance Madness - brightonSEO 2018
Web Performance Madness - brightonSEO 2018Web Performance Madness - brightonSEO 2018
Web Performance Madness - brightonSEO 2018
 
A holistic approach to web performance
A holistic approach to web performanceA holistic approach to web performance
A holistic approach to web performance
 
Image Optimization
Image OptimizationImage Optimization
Image Optimization
 
Web Performance: 3 Stages to Success
Web Performance: 3 Stages to SuccessWeb Performance: 3 Stages to Success
Web Performance: 3 Stages to Success
 
Voices that matter: High Performance Web Sites
Voices that matter: High Performance Web SitesVoices that matter: High Performance Web Sites
Voices that matter: High Performance Web Sites
 
Photo echance. Problems. Solutions. Ideas
Photo echance. Problems. Solutions. Ideas Photo echance. Problems. Solutions. Ideas
Photo echance. Problems. Solutions. Ideas
 
Web graphics vector & roaster101
Web graphics  vector & roaster101Web graphics  vector & roaster101
Web graphics vector & roaster101
 
Image optimization and you
Image optimization and youImage optimization and you
Image optimization and you
 
Portable Network Graphics (PNG)
Portable Network Graphics (PNG)Portable Network Graphics (PNG)
Portable Network Graphics (PNG)
 
Trouble with distribution
Trouble with distributionTrouble with distribution
Trouble with distribution
 
Web Optimisation
Web OptimisationWeb Optimisation
Web Optimisation
 
Front-end performances
Front-end performancesFront-end performances
Front-end performances
 
File types pro forma
File types pro formaFile types pro forma
File types pro forma
 
Jpack presentation
Jpack presentationJpack presentation
Jpack presentation
 
Images - 7 mistakes (first draft)
Images - 7 mistakes (first draft)Images - 7 mistakes (first draft)
Images - 7 mistakes (first draft)
 
Altitude London 2018: A hands-on tour of Image Optimisation workshop
Altitude London 2018: A hands-on tour of Image Optimisation workshopAltitude London 2018: A hands-on tour of Image Optimisation workshop
Altitude London 2018: A hands-on tour of Image Optimisation workshop
 
Super speed around the globe - SearchLeeds 2018
Super speed around the globe - SearchLeeds 2018Super speed around the globe - SearchLeeds 2018
Super speed around the globe - SearchLeeds 2018
 
SearchLeeds 2018 - Bastian Grimm - Peak Ace - International site speed: Going...
SearchLeeds 2018 - Bastian Grimm - Peak Ace - International site speed: Going...SearchLeeds 2018 - Bastian Grimm - Peak Ace - International site speed: Going...
SearchLeeds 2018 - Bastian Grimm - Peak Ace - International site speed: Going...
 

Más de Guy Podjarny

Serverless Security: What's Left To Protect
Serverless Security: What's Left To ProtectServerless Security: What's Left To Protect
Serverless Security: What's Left To ProtectGuy Podjarny
 
Securing Serverless - By Breaking In
Securing Serverless - By Breaking InSecuring Serverless - By Breaking In
Securing Serverless - By Breaking InGuy Podjarny
 
Serverless Security: What's Left to Protect?
Serverless Security: What's Left to Protect?Serverless Security: What's Left to Protect?
Serverless Security: What's Left to Protect?Guy Podjarny
 
Secure Node Code (workshop, O'Reilly Security)
Secure Node Code (workshop, O'Reilly Security)Secure Node Code (workshop, O'Reilly Security)
Secure Node Code (workshop, O'Reilly Security)Guy Podjarny
 
Stranger Danger (NodeSummit, 2016)
Stranger Danger (NodeSummit, 2016)Stranger Danger (NodeSummit, 2016)
Stranger Danger (NodeSummit, 2016)Guy Podjarny
 
Stranger Danger: Securing Third Party Components (Tech2020)
Stranger Danger: Securing Third Party Components (Tech2020)Stranger Danger: Securing Third Party Components (Tech2020)
Stranger Danger: Securing Third Party Components (Tech2020)Guy Podjarny
 
High Performance Images: Beautiful Shouldn't Mean Slow (Velocity EU 2015)
High Performance Images: Beautiful Shouldn't Mean Slow (Velocity EU 2015)High Performance Images: Beautiful Shouldn't Mean Slow (Velocity EU 2015)
High Performance Images: Beautiful Shouldn't Mean Slow (Velocity EU 2015)Guy Podjarny
 
HTTPS: What, Why and How (SmashingConf Freiburg, Sep 2015)
HTTPS: What, Why and How (SmashingConf Freiburg, Sep 2015)HTTPS: What, Why and How (SmashingConf Freiburg, Sep 2015)
HTTPS: What, Why and How (SmashingConf Freiburg, Sep 2015)Guy Podjarny
 
High Performance Images: Beautiful Shouldn't Mean Slow
High Performance Images: Beautiful Shouldn't Mean SlowHigh Performance Images: Beautiful Shouldn't Mean Slow
High Performance Images: Beautiful Shouldn't Mean SlowGuy Podjarny
 
Responsive In The Wild, 2014
Responsive In The Wild, 2014Responsive In The Wild, 2014
Responsive In The Wild, 2014Guy Podjarny
 
Third Party Performance (Velocity, 2014)
Third Party Performance (Velocity, 2014)Third Party Performance (Velocity, 2014)
Third Party Performance (Velocity, 2014)Guy Podjarny
 
Rules driven-delivery
Rules driven-deliveryRules driven-delivery
Rules driven-deliveryGuy Podjarny
 
Responsive In The Wild (SmashingConf, 2014)
Responsive In The Wild (SmashingConf, 2014)Responsive In The Wild (SmashingConf, 2014)
Responsive In The Wild (SmashingConf, 2014)Guy Podjarny
 
Third party-performance (Airbnb Nerds, Nov 2013)
Third party-performance (Airbnb Nerds, Nov 2013)Third party-performance (Airbnb Nerds, Nov 2013)
Third party-performance (Airbnb Nerds, Nov 2013)Guy Podjarny
 
Third Party Performance
Third Party PerformanceThird Party Performance
Third Party PerformanceGuy Podjarny
 
Step by Step Mobile Optimization
Step by Step Mobile OptimizationStep by Step Mobile Optimization
Step by Step Mobile OptimizationGuy Podjarny
 
Quantifying The Mobile Difference
Quantifying The Mobile DifferenceQuantifying The Mobile Difference
Quantifying The Mobile DifferenceGuy Podjarny
 
Performance Implications of Mobile Design (Perf Audience Edition)
Performance Implications of Mobile Design (Perf Audience Edition)Performance Implications of Mobile Design (Perf Audience Edition)
Performance Implications of Mobile Design (Perf Audience Edition)Guy Podjarny
 
Performance Implications of Mobile Design
Performance Implications of Mobile DesignPerformance Implications of Mobile Design
Performance Implications of Mobile DesignGuy Podjarny
 
Unravelling Mobile Web Performance
Unravelling Mobile Web PerformanceUnravelling Mobile Web Performance
Unravelling Mobile Web PerformanceGuy Podjarny
 

Más de Guy Podjarny (20)

Serverless Security: What's Left To Protect
Serverless Security: What's Left To ProtectServerless Security: What's Left To Protect
Serverless Security: What's Left To Protect
 
Securing Serverless - By Breaking In
Securing Serverless - By Breaking InSecuring Serverless - By Breaking In
Securing Serverless - By Breaking In
 
Serverless Security: What's Left to Protect?
Serverless Security: What's Left to Protect?Serverless Security: What's Left to Protect?
Serverless Security: What's Left to Protect?
 
Secure Node Code (workshop, O'Reilly Security)
Secure Node Code (workshop, O'Reilly Security)Secure Node Code (workshop, O'Reilly Security)
Secure Node Code (workshop, O'Reilly Security)
 
Stranger Danger (NodeSummit, 2016)
Stranger Danger (NodeSummit, 2016)Stranger Danger (NodeSummit, 2016)
Stranger Danger (NodeSummit, 2016)
 
Stranger Danger: Securing Third Party Components (Tech2020)
Stranger Danger: Securing Third Party Components (Tech2020)Stranger Danger: Securing Third Party Components (Tech2020)
Stranger Danger: Securing Third Party Components (Tech2020)
 
High Performance Images: Beautiful Shouldn't Mean Slow (Velocity EU 2015)
High Performance Images: Beautiful Shouldn't Mean Slow (Velocity EU 2015)High Performance Images: Beautiful Shouldn't Mean Slow (Velocity EU 2015)
High Performance Images: Beautiful Shouldn't Mean Slow (Velocity EU 2015)
 
HTTPS: What, Why and How (SmashingConf Freiburg, Sep 2015)
HTTPS: What, Why and How (SmashingConf Freiburg, Sep 2015)HTTPS: What, Why and How (SmashingConf Freiburg, Sep 2015)
HTTPS: What, Why and How (SmashingConf Freiburg, Sep 2015)
 
High Performance Images: Beautiful Shouldn't Mean Slow
High Performance Images: Beautiful Shouldn't Mean SlowHigh Performance Images: Beautiful Shouldn't Mean Slow
High Performance Images: Beautiful Shouldn't Mean Slow
 
Responsive In The Wild, 2014
Responsive In The Wild, 2014Responsive In The Wild, 2014
Responsive In The Wild, 2014
 
Third Party Performance (Velocity, 2014)
Third Party Performance (Velocity, 2014)Third Party Performance (Velocity, 2014)
Third Party Performance (Velocity, 2014)
 
Rules driven-delivery
Rules driven-deliveryRules driven-delivery
Rules driven-delivery
 
Responsive In The Wild (SmashingConf, 2014)
Responsive In The Wild (SmashingConf, 2014)Responsive In The Wild (SmashingConf, 2014)
Responsive In The Wild (SmashingConf, 2014)
 
Third party-performance (Airbnb Nerds, Nov 2013)
Third party-performance (Airbnb Nerds, Nov 2013)Third party-performance (Airbnb Nerds, Nov 2013)
Third party-performance (Airbnb Nerds, Nov 2013)
 
Third Party Performance
Third Party PerformanceThird Party Performance
Third Party Performance
 
Step by Step Mobile Optimization
Step by Step Mobile OptimizationStep by Step Mobile Optimization
Step by Step Mobile Optimization
 
Quantifying The Mobile Difference
Quantifying The Mobile DifferenceQuantifying The Mobile Difference
Quantifying The Mobile Difference
 
Performance Implications of Mobile Design (Perf Audience Edition)
Performance Implications of Mobile Design (Perf Audience Edition)Performance Implications of Mobile Design (Perf Audience Edition)
Performance Implications of Mobile Design (Perf Audience Edition)
 
Performance Implications of Mobile Design
Performance Implications of Mobile DesignPerformance Implications of Mobile Design
Performance Implications of Mobile Design
 
Unravelling Mobile Web Performance
Unravelling Mobile Web PerformanceUnravelling Mobile Web Performance
Unravelling Mobile Web Performance
 

Último

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 

Último (20)

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 

Putting Your Images on a Diet (SmashingConf, 2014)

  • 1. Faster ForwardTM PUTTING YOUR IMAGES ON A DIET Guy Podjarny (@guypod) CTO, Web Experience, Akamai Everything you wanted to know about image compression… and then some.
  • 2. Faster ForwardTM We have an image problem… Images appear simple Images seem friendly Images look like they can’t hurt But while you weren’t looking… Images Have Been Taking over The World (wide web)
  • 3. Faster ForwardTM Images make up 63-66% of Page Bytes 17% 3% 5% 9% 3% 1054, 63% Desktop Bytes Scripts CSS Flash Other HTML Images 23% 5% 0% 1% 5% 552, 6 6% Mobile Bytes Scripts CSS Flash Other HTML Images
  • 4. Faster ForwardTM Image Byte Increase over last 3 years It’s not more images, It’s BIGGER images 2.2x more Image Bytes in 3 years 32% more bytes in 1 year
  • 5. Faster ForwardTM What is there to optimize with images? - Today’s focus: Image Compression - Optimizing image formats & encoding - There are other ways to optimize images - Optimize Image Loading - Optimize Image Delivery - Responsive Images - …
  • 6. Faster ForwardTM LET’S START AT THE BEGINNING…
  • 7. Faster ForwardTM GIF – Graphics Interchange Format - 27 Years Old (1987) - 256 Colors - “Simple” Transparency - No partial (Alpha) transparency - Supported Everywhere - Supports Animation - Previously Patented - Patents expired by now
  • 8. Faster ForwardTM PNG – Portable Network Graphics - 18 Years Old (1996) - Supports 8-32 bit color palettes - PNG8 and PNG24 Most Common - Supports Alpha Transparency - Good browser support - Certain issues in IE 6-8 - Non-patented - Supports Animation (MNG)! - No browser support
  • 9. Faster ForwardTM Lossless PNG Compression - Delta-Filter Encoding - Write pixels as delta from neighbors - Compress using LZ77 - Reference past sequences - Compress using Huffman code - Identify repeating sequences - Code popular ones with fewer bytes = 1,2,3,4,5, 0x20 = 1x25 = 1,2,3,4,5, (-5,5)x5 Up Delta Left Delta Source: Sergey Chikuyonok, Smashing Magazine
  • 10. Faster ForwardTM Lossless PNG Optimization - Delta Filter Optimization - Per row, choose comparison target: None, Left, Up, Average, Paeth - Convert from PNG 24 -> 8 - Possibly using multiple PNG 8 layers - Tune LZ77 distance/length parameters - Tune Huffman buffer size - Trade “Alpha” transparency with simple (100%) transparency - PNG Optimization Tools: PNGCrush, OptiPNG
  • 11. Faster ForwardTM JPEG – Joint Photographic Experts Group - 22 years old (1992) - Supports RGB Colors (24 bit) - Supports custom color palettes - No Transparency Support - Doable with HTML5 Canvas Hacks - No Animation Support - Not impressed… - It’s a Lossy Format
  • 12. Faster ForwardTM JPEG Dominates Page Bytes, But PNG Is Growing 17% 25%
  • 13. Faster ForwardTM JPEG Compression - Simplified 1. Divide image into 8x8 pixel blocks
  • 14. Faster ForwardTM JPEG Compression - Simplified 1. Divide image into 8x8 pixel blocks 2. Split Luminance & Chrominance Y Cb Cr
  • 15. Faster ForwardTM YCbCr (YUV) Visualization – Grand Tetons Source: IE Blog
  • 16. Faster ForwardTM Chroma Subsampling - Chroma diffs are less noticeable - Subsampling “merges” adjacent pixels - Most popular is 4:2:2, 4:2:0 - Reduce Chroma bytes by 2x or 4x - Tools often deduce subsamplling - Based on quality tier - Photoshop Example: - no subsampling for quality 51-100 - 4:2:0 subsamplling for quality 0-50 Source: JPEG For The Horseshoe Crabs
  • 17. Faster ForwardTM JPEG Compression - Simplified 1. Divide image into 8x8 pixel blocks 2. Split Luminance & Chrominance 3. Chroma Subsampling 4. Write pixels as ~delta from average • and round (DCT + Quantization) Y Cb Cr
  • 18. Faster ForwardTM JPEG Compression - Simplified 1. Divide image into 8x8 pixel blocks 2. Split Luminance & Chrominance 3. Chroma Subsampling 4. Write pixels as ~delta from average and round (DCT + Quantization) 5. Write as line, compress (Huffman) = -9,-1,0(x62)
  • 19. Faster ForwardTM JPEG Compression - Simplified 1. Divide image into 8x8 pixel blocks 2. Split Luminance & Chrominance 3. Chroma Subsampling 4. Write pixels as delta from average and round (DCT + Quantization) 5. Write as line, compress (Huffman) Q=10 Q=50 Original
  • 20. Faster ForwardTM Original PNG: 574 KB JPEG, Q=90: 105 KB
  • 21. Faster ForwardTM Original PNG: 574 KB JPEG, Q=75: 53 KB
  • 22. Faster ForwardTM Original PNG: 574 KB JPEG, Q=40: 30 KB
  • 23. Faster ForwardTM Original PNG: 574 KB JPEG, Q=20: 18 KB
  • 24. Faster ForwardTM Original PNG: 574 KB JPEG, Q=10: 11 KB
  • 25. Faster ForwardTM Original PNG: 574 KB JPEG, Q=5: 7 KB
  • 26. Faster ForwardTM Lossy Compression – Not for Everyone GIF, 11 KB JPEG, Q=80, 8 KB JPEG, Q=30, 4 KB Average Color not representative PNG, 7 KB
  • 27. Faster ForwardTM JPEG Optimization - Control Quality - 75-85 tops - Quality level ≠ percentage - Tools interpret quality differently - Tune Huffman Buffer Size - Use Arithmetic Encoding (vs Huffman) - Low adoption, no browser support - Tools: jpegtran, ImageMagick 0 50 100 150 200 250 300 350 0 20 40 60 80 100 120 Quality vs File Size
  • 29. Faster ForwardTM JPEG Optimization - Control Quality - 75-85 tops, try to go lower - Tune Huffman Buffer Size - Remove Metadata - Tools: jpegtran, ImageMagick
  • 30. Faster ForwardTM JPEG Baseline vs. Progressive Baseline Progressive http://www.bookofspeed.com/chapter5.html Pro-Tip: Configure how blocks are “interlaced” (The “Coefficient”) - Controls minimum quality level - Affects Size
  • 31. Faster ForwardTM Baseline vs Progressive – Visual Progress Baseline Progressive Patrick Meenan: “… Looking at the Speed Index, we saw median improvements of 7% on Cable and 15% on DSL …” Loading…
  • 32. Faster ForwardTM JPEG Baseline vs. Progressive Baseline Progressive http://www.bookofspeed.com/chapter5.html 1 2 0 0 1 0 0 0 3 -1 0 0 1 2 0 0 1 0 0 0 3 -1 0 0 1 1 3 2 0 -1 0 0 0 0 0 0 1 1 3 2 0 -1 EOB Mo’ zeros, Mo’ compression
  • 33. Faster ForwardTM Baseline vs Progressive – File Size Baseline – Progressive Size for 100,000 JPEGs Stoyan Stefanov: Images of size 10K+ likely smaller as Progressive. Median delta is 3%, Up to 10% common, 250KB gap extreme. Progressive Smaller Baseline Smaller
  • 34. Faster ForwardTM Progressive vs Baseline – Current Reality Ann Robson: “… In a thousand-image sample, 92.6% are baseline …” Patrick Meenan: “… I crawled all 7 million JPEG images that were served by the top 300k websites in the May 1st HTTP Archive crawl and came out with....wait for it.... still only 7% …”
  • 35. Faster ForwardTM Lossless JPEG Optimization - Control Quality - 75-85 tops, try to go lower - Tune Huffman Buffer Size - Remove Metadata - Consider (and default to) Progressive over Baseline - Tune Progressive Scan coefficients - Tools: jpegtran, ImageMagick, jpegrescan (~1.2% better)
  • 36. Faster ForwardTM Retina Images bg_header_retina.png – 56 KB bg_header.png – 14KB 1 2 43 • Marketing-speak for 2x pixel ratio (or more) • 1 CSS pixel = 4 real pixels • Other ratios are possible (1.5x common) 3X
  • 37. Faster ForwardTM JPEG Retina Trick - Retina images often 3-4x file size - Regular images are “fuzzy” on Retina - Double size, Lower Quality = Sharper Image, Smaller File - Discovered by Netvlies & Thomas Fuchs - Popularized by Filament Group - Not clear WHY it works - Artifact of tools “Quality” level? - Higher Memory Usage - More on that later…
  • 38. Faster ForwardTM Lossless JPEG Optimization - Control Quality - 75-85 tops, try to go lower - Tune Huffman Buffer Size - Remove Metadata - Consider (and default to) Progressive over Baseline - Tune Progressive Scan coefficients - Consider Retina Double-Size-Low-Quality Trick - Tools: jpegtran, ImageMagick, jpegrescan, ImageOptim
  • 40. Faster ForwardTM WebP – Web Picture? - 3 Years Old (2011) - Pronounced “Weppy” - Supports Lossless & Lossy Modes - Very well documented - See: https://developers.google.com/speed/webp/ - Related VP8 Google Patents “released” by Google - Other patents licensed by Google for global use - Nokia still claiming related Patents
  • 41. Faster ForwardTM WebP vs PNG Google: Lossless WebP 26%-34% Smaller than PNG Yoav Weiss: Lossless WebP 33%-42% Smaller than PNG
  • 42. Faster ForwardTM WebP vs JPEG Google: Lossy WebP 25%- 34% Smaller than JPEG Yoav Weiss: Lossy WebP 37% Smaller than PNG
  • 43. Faster ForwardTM WebP – Impressed Yet? - 26% - 42% Smaller than PNG - 25% - 37% Smaller than JPEG - Supports Alpha Transparency - Supports Animation! - Why did waste time talking about the other formats?! 23+ 12.1+
  • 44. Faster ForwardTM JPEG XR (eXtended Range) - 4 Years Old (2009) - Smaller files than JPEG - A big bigger than WebP - Patented by Microsoft - Under “Open Spec Promise” - Jxrlib has BSD License - Support: IE 9+ (incl. Mobile) - Properly works in IE 10+ - Includes IE Mobile 10+
  • 45. Faster ForwardTM Similarity Tests - Formats work differently - Quality # means different visual quality per format - Similarity algorithms help detect “similar” images - Across image formats - Sample algo: DSSIM
  • 46. Faster ForwardTM WebP vs JPEG-XR vs Optimized JPEG (Akamai Data) Nick Doyle (Akamai): 1. WebP & JXR Both better than JPEG. 2. Beware the different Quality scales
  • 47. Faster ForwardTM JPEG 2000 - 6-14 Years Old (2000/2008) - Uses DWT instead of DCT - Along with other improvements - ~30% Smaller than JPEG - Based on initial Akamai research - Patented, but free to use - As agreed by ~20 patent-owning org’s - Support: Safari & Mobile Safari - iOS 6+, Mac Safari, not Win Safari
  • 48. Faster ForwardTM Processing Images Ain’t Easy… - Images are 60% of bytes - likely <95% of memory usage - Resized Retina images take up 4x the memory! - Output pushed to GPU, often through slow Mobile BUS - GPUs now starting to process YUV – faster with less RAM for JPEGs - Network time is not the only thing that matters… Typical Image Decoding Flow (Source: IE Blog): 30 KB JPG Input ~300 KB in YUV (~10 bbp) 1 MB After Upsampling (~32 bbp) RAM: Often 300-800ms on Mobile
  • 49. Faster ForwardTM Mozilla still undecided - Ran a comparative study: JPEG, JXR, WebP, HEVC-MSP - Used 4 algorithms to find “comparable” image across formats - HEVC-MSP deemed best, results inconclusive for others - Note: Study used PNG’s as source - Akamai’s studies used “live” website images 0.8 0.9 1 1.1 1.2 1.3 50 55 60 65 70 75 80 85 90 95 Relative File Size, Kodak Image Set, Y-SSIM JPEG JPEG XR WebP HEVC-MSP 0.5 0.6 0.7 0.8 0.9 1 1.1 50 55 60 65 70 75 80 85 90 95 Relative File Size, Kodak Image Set, RGB-SSIM JPEG JPEG XR WebP HEVC-MSP
  • 50. Faster ForwardTM New Image Formats - Summary Format Size vs JPEG Proggressive Transparency Support Hardware Decoding Encoder Browser Support JPEG N/A N/A No No jpegtran Everybody WebP -35% -35% Yes No cwebp JPEG XR -30% N/A In Spec, not Browsers Maybe jxrlib JPEG 2000 -30% N/A In Spec, not Browsers Maybe OpenJPEG 10+ 12.1+4+23+ 6+6+
  • 52. Faster ForwardTM When to use which format? - For tiny images (e.g. 1x1 pixel) use GIF - PNG-8 practically always smaller - For most small images, use PNG - Where possible, prefer JPEG to PNG - Use WebP/JXR/J2K where possible - Serve only to supporting clients - For Animation, use GIF - Seat back and reap the rewards…
  • 53. Faster ForwardTM A PICTURE COSTS A THOUSAND WORDS Guy Podjarny (@guypod) CTO, Web Experience, Akamai Thank You! Questions?

Notas del editor

  1. http://www.smashingmagazine.com/2009/07/15/clever-png-optimization-techniques/
  2. http://sixrevisions.com/graphics-design/jpeg-101-a-crash-course-guide-on-jpeg/
  3. Credit: http://www.ams.org/samplings/feature-column/fcarc-image-compression
  4. Credit: http://www.ams.org/samplings/feature-column/fcarc-image-compression
  5. Credit: http://www.ams.org/samplings/feature-column/fcarc-image-compression
  6. Credit: http://www.ams.org/samplings/feature-column/fcarc-image-compression
  7. http://linux.die.net/man/1/jpegtran
  8. http://linux.die.net/man/1/jpegtran
  9. http://www.bookofspeed.com/chapter5.html
  10. http://www.bookofspeed.com/chapter5.html
  11. http://www.bookofspeed.com/chapter5.html
  12. http://linux.die.net/man/1/jpegtran
  13. http://mobile.smashingmagazine.com/2013/09/16/responsive-images-performance-problem-case-study/
  14. http://linux.die.net/man/1/jpegtran
  15. http://calendar.perfplanet.com/2012/giving-your-images-an-extra-squeeze/
  16. http://calendar.perfplanet.com/2012/giving-your-images-an-extra-squeeze/
  17. http://hdview.wordpress.com/2013/05/30/jpegxr-updates/
  18. http://news.cnet.com/8301-1023_3-57608064-93/mozilla-unimpressed-with-googles-web-photo-standard/