Page 1 Image Optimization 7 mistakes (and how to correct them) Stoyan Stefanov Yahoo! Exceptional Performance Velocity, June 24th, 2008, San Francisco.

Slides:



Advertisements
Similar presentations
Optimizing Websites with YSlow Tom Lianza Co-Founder Wishlisting.com Tom Lianza Co-Founder Wishlisting.com.
Advertisements

CS193H: High Performance Web Sites Lecture 22: Vol 2 – Optimize Images, Use Iframes Sparingly, Flush the Document Early Steve Souders Google
Web Performance Meetup 1 Web Performance 101 Jeremy
The Web Wizards Guide to HTML Chapter Five Working with Images.
Stevesouders.com/docs/velocity-wpo pptx Disclaimer: This content does not necessarily reflect the opinions of my employer.
CHAPTER 15 WEBPAGE OPTIMIZATION. LEARNING OBJECTIVES How to test your web-page performance How browser and server interactions impact performance What.
1 Caching in HTTP Representation and Management of Data on the Internet.
Multimedia for the Web: Creating Digital Excitement Multimedia Element -- Graphics.
Analysis and Performance Information Systems 337 Prof. Harry Plantinga.
Website Development with PHP and MySQL Introduction.
Chapter 4 Adding Images. Inserting and Aligning Images Using CSS When you choose graphics to add to a web page, it’s important to use graphic files in.
Meta Tags What are Meta Tags And How Are They Best Used?
Mark Phillip markphillip.com 200s, 304s, Expires Headers, HTTP Compression, And You.
Understanding Web Graphics Web Design Section 5-4 Part or all of this lesson was adapted from the University of Washington’s “Web Design & Development.
Performance, SEO, Accessibility Ivan Zhekov Telerik Corporation
22-Aug-15 | 1 |1 | Help! I need more servers! What do I do? Scaling a PHP application.
INFSCI  “Users pay close attention to photos and other images that contain relevant information, but ignore fluffy pictures used to “jazz up” webpages.”
MIS 208 Fundamentals of Web Publishing Week 6 Performance Editing Graphics Imagemaps.
PHOTOSWAP Albert Park & Brandon Ochs. What is PhotoSwap?  Social networking platform for iOS  Users share images with each other  Extract sensor data.
Designing for the Unknown. Challenges of Web Design As frustrating as it may be – there is no guarantee that people will see/experience your web pages.
Paint Shop Pro and the Web Rick Matthews Dept. of Physics, Wake Forest University And The International Center for Computer Enhanced Learning
Keeping Front End Dependencies Under Control Rachel Lehman Technical Team at Interfolio, -
Chapter 4 Adding Images. Chapter 4 Lessons Introduction 1.Insert and align images 2.Enhance an image and use alternate text 3.Insert a background image.
Graphic images for computers Stored in files of binary data - Binary blobs Software has to know the binary format to decode the file and render an image.
1 Chapter 2 & Chapter 4 §Browsers. 2 Terms §Software §Program §Application.
Unit 1 – Web Concepts Instructor: Brent Presley. ASSIGNMENT Read Chapter 1 Complete lab 1 – Installing Portable Apps.
CIT 256 Dreamweaver Intro. Dr. Beryl Hoffman. Start Dreamweaver Start from Start Menu/Adobe Master Collection CS6/ Adobe Dreamweaver CS6 Choose Create.
Customer Service and Support Sutherland Global Services Consultant Learning Services Microsoft Store.
Week 11 Using Dreamweaver, Photoshop, and Fireworks: Graphics Production for the Web Stanford University Continuing Studies CS 38 Mark Branom
CHAPTER 4 LINKS Creating links between pages Linking to other sites links.
8 Using Web Graphics Section 8.1 Identify types of graphics Identify and compare graphic formats Describe compression schemes Section 8.2 Identify image.
Introduction to CacheWorx Lucian Plesea - Esri Robert Jensen - Esri.
Digital Image Formats: An Explanation Guilford County SciVis V
Abigail morris.  Today I'm going to be explaining why the Internet relies on a number of protocols in order to function properly.  A protocol is simply.
CS 4720 Dynamic Web Applications CS 4720 – Web & Mobile Systems.
Types of Graphics  Vector Individual scalable objects defined by mathematical equations  Bitmap Pixels (tiny, single-colored square) in a grid Most.
Optimizing Web pages Hyun Joo LEE LIS 385 T: Information Architecture and Design March 27, 2003.
Empirical Quantification of Opportunities for Content Adaptation in Web Servers Michael Gopshtein and Dror Feitelson School of Engineering and Computer.
Offline Web Apps - an offline web application is a list of URLs for HTML, CSS, JavaScript, images, or any other kind of resource. Most browsers have offline.
Elements of Website Design. Homepage ● first page of the website ● website title ● general introduction ● authors or creators information ● date updated.
Web Graphics. Web graphics Bandwidth is king Graphics must load quickly Graphics must be optimized All other components except for text, gif and jpg are.
Web Design and Development. World Wide Web  World Wide Web (WWW or W3), collection of globally distributed text and multimedia documents and files 
HTML A brief introduction HTML1. HTML, what is? HTML is a markup language for describing web documents (web pages). HTML stands for Hyper Text Markup.
1 After completing this lesson, you will be able to: Comprehend the basics of Web graphics. View and manipulate Web graphics in a graphics program. Describe.
WRA 210: 10/7/13 IMAGES. TODAY’S AGENDA Reminder about Module 8 - test your links!Module 8 Overview of hierarchies, naming How images work on the web.
HTTP transaction with Graphics HTML file + two graphics files.
Digital Image Formats: An Explanation Guilford County SciVis V
PHP Quebec 2008 Page 1 High Performance Web Pages Stoyan Stefanov Yahoo! Exceptional Performance PHP Quebec, March.
WEB GRAPHICS EXPLORING COMPUTER SCIENCE - LESSON 3-4.
Dr. Abdullah Almutairi Spring PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages. PHP is a widely-used,
 Linking to a school website page  Linking to a class blog  Linking to student writing  Giving instructions to students.
IN THIS LESSON WE WILL REVIEW THE STRUCTURE OF THE INTERNET AND HOW BROWSERS ASSEMBLE WEBSITES BASED ON INSTRUCTIONS THEY RECEIVE FROM SERVERS. Internet.
Intro to Web Performance Ten Ways to a Faster Website Presented by: Sheila Eaton and Mohammad Durrani TechKnowFile, University of Toronto, May 5, 2016.
13 June – Session : Graphics Different types of Graphics for the web Features of image editing software Good practice for image editing.
Technical SEO tips for Web Developers Richa Bhatia Singsys Pte. Ltd.
Enhance Your Page Load Speed And Improve Traffic.
Computer Basics Introduction CIS 109 Columbia College.
Introduction to Programming the WWW I CMSC Winter 2003 Lecture 4.
Exploring Computer Science - Lesson 3-4
Exploring Computer Science - Lesson 3-4
Image Formats.
Time is the enemy: Ten Core Lessons for Achieving Peak
JPG vs GIF vs PNG What is the difference?
Exploring Computer Science - Lesson 3-4
Hints and tips for faster web apps
Web Design Designing for the Unknown.
Creating Images for the Web
Follow the Data Data (and information) move from place to place in computer systems and networks. As it moves it changes form frequently. This story.
Image Optimization: 7 mistakes
Yale Digital Conference 2019
Presentation transcript:

Page 1 Image Optimization 7 mistakes (and how to correct them) Stoyan Stefanov Yahoo! Exceptional Performance Velocity, June 24th, 2008, San Francisco

Page 2 About the presentation Image optimization for the non-designer 7 mistakes all sites make, even the big ones Trivial to correct, serious savings Easy win –improve page load time –save bandwidth –save disk space –save servers (and energy and the planet) –… without compromising quality

Page 3 About the presenter Yahoo! Exceptional Performance (research, consulting) YSlow lead developer Open Source contributor (PEAR, Firebug) Blog Articles and books author

Hmm, images? Q: Is this really important? A: Let’s survey the global top 10 sites.

Page 5 What % of page weight is images? Average 45.6% Not exactly half, but pretty close Your site may be different, amazon.com for example is 71% images huge potential 1Yahoo!29% 2Google75% 3YouTube62% 4Live.com64% 5MSN41% 6MySpace48% 7Wikipedia39% 8Facebook35% 9Blogger27% 10Yahoo! JP36%

Page 6 Mistake #1: Using GIF when PNG is smaller

Page 7 GIF vs. PNG GIFPalette PNG (aka PNG8, aka indexed) Truecolor PNG Number of colors 256 Up to 48bit TransparencyBoolean (on/off) Alpha (variable) * Browser support Nearly allAll A-grade (96%+) AnimationYesNo (future) * some IE < v.7 issues

PNG transparency and IE Truecolor PNG IE 7 and up IE 6 and earlier PNG8 IE 7 and up IE 6 and earlier Verdict: IE7+ is OK; IE6 supports GIF-like transparency

Page 9 GIF vs. PNG PNG8 can do everything a GIF can do, and more (sans cheesy Web 1.0 animations) PNG8 works across all A-Grade browsers Q: And what about the size? A: Let’s survey the top 10 sites and convert all GIFs to PNGs to check if there are savings

Page 10 GIF-to-PNG 1Yahoo!9.55% 2Google22.95% 3YouTube33.82% 4Live.com19.93% 5MSN13.53% 6MySpace17.65% 7WikipediaNo GIFs! 8Facebook17.47% 9Blogger24.27% 10Yahoo! JP24.58% Average 20.42% savings

Page 11 Take away #1: Choose PNG over GIF LOSSLESS!

Page 12 Mistake #2: Not crushing PNGs

Page 13 About the PNG chunks PNGs store information in "chunks" Most chunks can safely be deleted Most image programs DO NOT optimize Command line tools: –pngcrush –pngrewrite –OptiPNG –PNGOut Example: > pngcrush -rem alla -brute -reduce src.png dest.png

Page 14 Crush top 10 and check for savings 1Yahoo!15.52% 2Google Reader22.60% 3YouTube17.32% 4Live.comNo PNGs 5MSNNo PNGs 6MySpace25.44% 7Wikipedia21.32% 8Facebook9.08% 9Blogger1.07% 10Yahoo! JPNo PNGs Average 16.05% savings

Page 15 Take away #2: Crush your PNGs LOSSLESS!

Page 16 Mistake #3: Not stripping JPEG metadata

Page 17 JPEG metadata Comments EXIF –camera information –thumbnail! –audio!?! –… Application specific (e.g. Photoshop)

Page 18 Lossless JPEG operations jpegtran ( Free command-line tool Loseless operations such as crop, rotate You probably have it installed already Example: > jpegtran -copy none -optimize -perfect src.jpg dest.jpg

Page 19 Running jpegtran on top 10 sites 1Yahoo!2.62% 2GoogleNo jpegs 3YouTube10.71% 4Live.com0.47% 5MSN7.43% 6MySpace4.28% 7WikipediaNo jpegs 8Facebook13.59% 9Blogger38.35% 10Yahoo! JP17.31% Average 11.85% savings

Page 20 Take away #3: Strip needless JPEG metadata LOSSLESS!

Page 21 Mistake #4: Using truecolor PNGs when palette PNG is good enough

Page 22 Truecolor vs. palette PNGs Palette PNGs (PNG8) have 256 colors Truecolor PNGs could have millions In practice, truecolor PNGs often have less than 1000 colors Otherwise it would mean they are photos and should be JPEGs Human eye is not that sensitive

Page 23 Truecolor vs. palette PNGs Convert truecolor to palette How about 50% savings? Solves IE<7’s little alpha transparency problem Warning 1: LOSSY –But no one will ever know Warning 2: automation is hard when there’s alpha

Page 24 Truecolor vs. palette PNGs Command-line tools: pngquant ( pngnq ( Example: > pngquant 256 src.png

Page 25 Take away #4: Make all PNGs palette PNGs * * but manually check the result (or wait for someone to complain, chances are you'll be waiting in vain ;)

Page 26 Mistake #5: Using CSS alpha filters

Page 27 CSS filters Back to the problem with truecolor PNG alpha transparency in earlier IEs AlphaImageLoader CSS filter to fix the issue IE proprietary Blocks rendering, freezes the browser Increased memory consumption Per element, not per image! CSS code for sprites becomes messy

Page 28 Avoid filters Best: Avoid completely, use gracefully degrading PNG8 Fallback: use underscore hack _filter not to penalize IE7+ users Yahoo! Search saved ms for users of IE5&6

Page 29 Take away #5: Avoid AlphaImageLoader, try PNG8 or at least _filter

Page 30 Mistake #6: Serve generated images “as-is”

Page 31 Dynamically generated images GD library doesn't do what pngcrush does Generated images are bigger From big to small: generated GIF > generated PNG > crushed PNG Server resources on every request

Page 32 Recipe for generated images 1st request: generate write to disk pngcrush serve 2nd request: serve cached Estimate 5-30% savings

Page 33 Case study: Google charts API Original (707 colors)Crushed (707 colors)PNG8 (256 colors) 12% saving38% saving

Page 34 Case study: Google charts API Original (1408 colors)Crushed (1408 colors)PNG8 (256 colors) 25% saving55% saving (1000+ colors are lost but who can tell?)

Page 35 Take away #6: Crush generated images LOSSLESS!

Page 36 Mistake #7: Not combining images

Page 37 CSS Sprites … CSS: HTML:

Page 38 CSS Sprites Size of the combined image is usually less You save HTTP requests Article: Tool:

Page 39 Optimizing sprites

Page 40 Take away #7: Use CSS Sprites Stay within the palette number of colors (use PNG8)

Page 41 Bonus mistake: Improper favicon.ico Necessary evil: –The browser will request it –Better not respond with a 404 –Cookies are sent –Cannot be on CDN –Interferes with the download sequence Make it small (<= 1K) Animated favicons are not cool Set Expires header (but not “forever”) Tools: imagemagick, png2ico Case study: Yahoo! Search - favicon.ico is 9% of all page views

Page 42 Bonus mistake #2: serving images from your app server Option 1: use a CDN Option 2: setup a static server –stripped down Apache or LightTPD –no libraries, no PHP, no Perl, etc –serve images (and other static components) –request -> find on disk -> serve –"Never expires" policy –no cookies

Page 43 Wrapping up You can save 10-30% in unnecessary image size!

Page 44 URLs – Exceptional Performance YUI blog YDN (Yahoo Developer Network) YDN blog Mailing list (Yahoo! Group) performance/ Feedback

Page 45 Thank you!

Page 46 Credits Apolo 17 Full-Earth Photographhttp://svs.gsfc.nasa.gov/vis/a000000/a002600/a002680/ W3C PNG Alpha Testhttp:// PNG8 - The Clear Winnerhttp://