Web Site Optimization: How To Speed Up Your Web Site By Minimizing Your GIF and PNG Image Bit-Depth
Are bloated images slowing down your web site and causing you lost business? Images comprise over 50% of the average web page so putting them on a diet is essential to improving web performance. One of the best ways to optimize GIFs and PNGs is to minimize the "bit-depth" or the number of colors within your images.
For palette-based formats like GIF and PNG, file size is directly related to the size of the color palette, or the number of colors in the image. As the number of colors in an image crosses a power of two, the file size jumps. A 33-color image must use a six-bit palette, while a 32-color image can use a 5-bit palette. Smaller palettes mean smaller codes (representing pixel patterns), which makes for smaller files. So minimizing the number of colors in index-color images like GIFs and PNGs will minimize file size.
The compression schemes used in GIFs (LZW) and PNGs (Deflate) are dictionary-based encoding algorithms. Dictionary based compression algorithms substitute shorter codes for longer patterns of strings within the data stream. Pixel patterns (substrings) in the data stream found in the dictionary are replaced with a single code. If a substring is not found in the dictionary, a new code is created and added to the dictionary. Compression is achieved when smaller codes are substituted for longer patterns of data.
The code size is based on the number of bits per pixel, and depends on the maximum length code within your dictionary. Thus the smaller your bit-depth, the smaller the codes representing your pixel pattern strings, and the smaller the file.
Choosing the right format for your images is the first step in optimizing web graphics. At lower bit-depths, banding can appear in smooth-toned images. Try quantizing your image to different palettes to minimize banding.
PNG Compression
PNG uses the deflate compression algorithm which is a newer, more efficient cousin of LZW. Deflate is designed to be free of patent problems. Deflate is a combination of the LZ77 algorithm found in zip programs like WinZIP and gzip, and Huffman coding. Deflate typically compresses files 20 to 30 percent smaller than LZW, which is the difference you'll find between gzip and compress. PNGs use a similar substitution technique, but are generally 5 to 25 percent smaller than GIFs, although there are exceptions. In addition to horizontal "scan-line" pattern substitution PNGs sometimes substitute for vertical patterns. PNG can also truncate color palettes. In general, the smaller the color palette, the smaller the overal file size.
Conclusion
To minimize the file size of palette-based image formats like GIF and PNG, minimize their bit-depth, or number of colors. Each time you pass a power of two, file size jumps higher. By minimizing the number of colors, and maximizing the flat-color areas you will create smaller, more efficient images destined for the Web.
Further Reading:
LZW Data Compression
http://www.dogma.net/markn/articles/lzw/lzw.htm
Mark Nelson breaks down the LZW compression algorithm for Dr. Dobb's Journal of October 1989.
Multimedia: Use Lossy Compression for Smaller GIFs and PNGs http://www.websiteoptimization.com/speed/tweak/lossy/
Lossy compression lets you squeeze more bytes out of your GIFs and PNGs. Lossy compression increases identical pixel patterns to improve compression in indexed-color images.
Multimedia: Use Weighted Optimization
http://www.websiteoptimization.com/speed/tweak/weighted/
Weighted optimization or regional compression applies different degrees of compression to different areas of your image. By varying the quality within images you can improve file size.
Optimizing Web Graphics
http://www.websiteoptimization.com/speed/12/
Chapter summary from Speed Up Your Site, shows how to correct, optimize, and compress images for minimum file size and maximum quality.
PNG Home Site
http://www.libpng.org/pub/png/
Greg Roelofs site devoted to all things PNG.
About The Author
Article by Andy King, author of the popular new book titled "Speed Up Your Site - Web Site Optimization". Visit Andy King's web site to learn the best Web Site Optimization practices for higher traffic and speed guaranteed. www.websiteoptimization.com
MORE RESOURCES:
 |
 |
 |
RELATED ARTICLES
You Cant Just Build A Website And Hope It Works!
Like any area of business your website needs some effort from you if its going to be successful. You'd be foolish to just build any old website and hope it works.
I Want To Be A Freelancer
So you have decided that you want to do freelance work. You have done your homework and have developed your skills in HTML, PHP, CMS, and a slew of other applications.
Better Web Site ROI: Efficient Online Business with SEO, PPC, Split Testing, and Forums
If you're looking for better web site ROI, chances are, the web is only one part of your business, you have a specific budget for your web site, and you want the site to not only carry its own weight, but why can't it make you some extra dough, too?The corporate situation: budgets need to be closely watched, and tech people can't get carried away with unnecessary frills.My own experience making money online and becoming and SEO expert was more guerilla than corporate.
Improving Usability for Screen Reader Users
Simply ensuring your website is accessible to screen reader users is unfortunately not enough to ensure these users can find what they're looking for in a reasonably quick and efficient manner. Even if your site is accessible to screen reader users, its usability could be so incredibly poor that they needn't have bothered coming to your site.
Conceptualize, Build and Publish a Web site
Conceptualize, Build and Publish a Web site - What's required to get startedAll of us knowingly or unknowingly, use a standard decision making process in our day-to-day lives. The very first step of this process is to decide whether TO DO or NOT TO DO.
How to Promote Your Law Firm Website On the Internet for Maximum Profit
Making maximum profit from your law firm website is important, but as a lawyer you might not have any clue about search engine optimization and Internet marketing for your legal site. However, it is not so difficult to poise your website to be successful online even if you are not experienced with Internet marketing and driving website traffic.
Top 7 Tips for Building an Antique Car Website
Like wine cars get more attractive to collectors as years pass by. The fact is there are only a finite number of cars made in the world in any model and make.
35% Revenue Increase? from Your Website!
2 Golden Rules for an Engaging Website35% of visitors fail to achieve their goal when they visit company websites! By following 2 simple rules, you can increase your web-derived revenue by 1/3 or more!Renowned website usability researcher, Jakob Nielsen, today (Nov 24) published results of his latest study. His test subjects used 139 websites.
Are Web Graphics Stealing Your Money?
They might not be wearing a mask and carrying a gun, but if you've got images on your web pages then they could be costing you a lot more money than you think every time a visitor looks at one. That's because image files are typically the biggest bandwidth user on any web page.
Web Analytics - Getting it Right
Understanding and using web analytics.In recent years, website marketers were concerned with increasing 'hits' and the 'stickiness' of their sites.
PHP Redirect
A PHP Redirect automatically transfers a web user from one URL to another. For example, typing foo.
What is Blogger.com?
In the late 1990's three San Francisco based web developers came up with the idea of being able to share information about anything on the web. The terminology they used was called blog.
Using Psychology Easily on Your Website to Make More Sales!
Psychology is a long word which everyone thinks, "no, that's not for me, it'll be too difficult". Apart from being lazy, anyone who thinks this is wrong.
The Power Is In The Pipes: How To Get Maximum Leverage From Your Website
What is the most important part of your online business?Many people would say: "my website". And that'sunderstandable - it's the most visible part of an internetbusiness.
Seven Daft Things Not To Do To Your Website
1. Splash pagesMost of the time splash pages are uncalled for.
Stop Losing Precious Web Site Traffic to the Dreaded World Wide Web Black Hole
You work hard to build traffic to your web page. If you are not doing 1 simple step you are loosing a portion of all your web site traffic to the dreaded World Wide Web Black Hole.
How to Get a Better Web Site ROI
Better Web Site ROIHow to increase your business profitability by hundreds of
percentWebsites are ubiquitous these days and everybody is trying to
get a better
web site ROI. With millions upon millions of sites all trying to
appeal to the same traffic, what can you do to improve your web
site ROI?What's In A NameYou can use Google Adwords to very quickly and cost effectively
improve your business profitability
by a significant amount - hundreds possibly thousands of
percent.
How To Convert More Sales On Your Website
One of the biggest mistakes that most online retailers make is they do not take into account typical buyer behaviour. The conversion from real world to online provides many benefits to the retailer, but present some real challenges for the customer because their buying decision is made more difficult in an online environment.
Why Local Service Companies Should Have a Website
The Internet is being used by local service business to improve sales today. Sales are improved because a website gives a company more credibility and in some cases generates leads.
Make Your Own Website - General Website Design Tips
Wow, we`ve already taken a domain and chosen a web host. Great job ! Now it`s time for something special: making your own website.
|