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.dogma.net/markn/articles/lzw/lzw.htm


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.dogma.net/markn/articles/lzw/lzw.htm


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.dogma.net/markn/articles/lzw/lzw.htm


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.dogma.net/markn/articles/lzw/lzw.htm


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. http://www.dogma.net/markn/articles/lzw/lzw.htm

top rated cleaning service Park Ridge ...
In The News:

ChatGPT Work, Meta Muse and Gemini Spark can monitor flight prices, sort your email inbox and track important deadlines, but savvy users start small.
iPhone, Samsung Galaxy and Google Pixel each hide a built-in tool that turns a video frame into a separate photo without any screenshot needed.
Operation KillSwitch dismantled KillSec's ransomware infrastructure, but investigators say a 16-year-old allegedly ran the entire cybercrime operation.
The Fox News Artificial Intelligence newsletter covers where voters will decide on AI data center ballot measures and Jeff Bezos' tech vision.
Apple's Impersonation Risk Detection in iOS 27 can flag suspicious activity inside apps, but the setting is off by default and must be enabled.
Federal Election Commission records can expose your name, address, employer and donation history once contributions exceed the $200 threshold.
Cybersecurity expert Morgan Wright says human skepticism remains the strongest defense against AI-driven phishing scams and voice cloning fraud schemes.
iPhone, Google Pixel and Samsung Galaxy each handle security updates differently, and one screen saying "up to date" may not tell the whole story.
Deborah Del Mastro heard what sounded like her daughter's terrified voice on the phone, launching a five-hour virtual kidnapping scam ordeal.
Hotel TV privacy risks go beyond forgotten passwords when you sign into Netflix or other streaming apps on shared devices you don't control.
Apple's iOS 27 Visual Intelligence now lets your iPhone search objects directly on screen, but Samsung Galaxy and Google Pixel have a head start.
x47.c Windows malware uses xAI's Grok to maintain persistence on infected PCs while stealing passwords, browser cookies and API keys from victims.
Frankie LaPenna fought three robots in a cage, including two modified EngineAI T800 humanoids that can kick with up to 850 pounds of force..
MacSync malware hides malicious commands inside iCloud calendar events to download additional payloads onto infected Macs without raising suspicion.
Joseph Holycross dismissed his racing heart for nearly two years until his Samsung Galaxy Watch detected atrial fibrillation and changed everything.
Home title fraud begins when criminals forge your signature on a deed. Here is how to check your own property records and set up free alerts.
Jeffrey Ladish, a former Anthropic security team member, warns AI agents are colluding and hacking with no reliable solution to keep them in check.
Instinct Concierge and Meta Muse can now place phone calls to businesses on your behalf, but the privacy and data access tradeoffs are significant.
Olivia Moore spent $100 to create a fake RushTok influencer using ChatGPT and MiniMax, and thousands of Bama Rush fans couldn't tell the difference.
RatHat Android malware uses AI to steal banking credentials, intercept two-factor authentication codes and reconstruct your PIN from touch inputs.
The Fox News AI Newsletter covers the latest artificial intelligence technology advancements, including the challenges and opportunities AI presents now and for the future.
Apple and Google password managers can flag compromised, weak and reused passwords on your phone before credential stuffing attacks can strike.
Researcher Peter Garrigan says Moonshot AI's Kimi model was manipulated into providing instructions for biological weapons and assassination plans.
iPhone, Google Pixel and Samsung Galaxy phones now offer call screening that asks unknown callers to identify themselves before your phone rings.
Ransomware can lock your irreplaceable photos and documents in seconds. A tested backup strategy and stronger cybersecurity habits are your best defense.

How Does Your Website Make Me Feel?

When people think about the Internet, they think about technology.... Read More

Profitable Websites for Exclusive Industries

In the region where my company is located, South Bend,... Read More

Tips for Building a Great Business Website

A website is lifeline of internet home business. In order... Read More

7 Questions to Understand Your Customer Better

Customer service questionnaires can help your clients better understand their... Read More

WYSIWYG Versus Coding: HTML With A Purpose

After years of working with entrepreneurs who developed their first... Read More

Conceptualize, Build and Publish a Web site

Conceptualize, Build and Publish a Web site - What's required... Read More

Developing A Website: 10 Tips For Getting Started

1. Be clear on your purpose.Building a website can be... Read More

Is Your Website Innovative? Increase Your Business Over Night!

While studying online for IT investment opportunities, I found that... Read More

The Number One Reason Most Websites Fail

Failure, just like success, is measured differently by each and... Read More

The Secret Benefit Of Accessibility: Part 2 - A Higher Search Engine Ranking

An additional benefit of website accessibility is an improved performance... Read More

What ROI You Should Expect From Your Web Site

Is Your Web Site an Expense or an Investment?Why don't... Read More

Building eCommerce Websites that Work - Part 2

Succeeding with an eCommerce website is a dream for many... Read More

Ever Wondered What Challenges Other People With Their Web Site?

Have you ever wondered what challenges are faced by other... Read More

But My Business Doesnt Need A Website!

Revenues are often lost because many business owners don't see... Read More

Improve Web Sales Figures Forever And Ever Amen!

"How do I improve web site sales figures?" The CEO... Read More

Build It and They Will Come

Build it and they will come is not always true;... Read More

Getting One-way Inbound Links: the 5 Major Strategies

With search engines putting a damper on direct reciprocal links,... Read More

The 5 Biggest Mistakes Almost All Web Designers Make

Huge Mistake #1: Creating a Website with Flash -- Did... Read More

How Worldly is Your World Wide Web?

The growth in Internet usage around the world is astounding... Read More

10 Tips For A Successful Website

Have you ever thought the secret behind the success of... Read More

Why You Need a Website

You hear a great deal about the Internet these days... Read More

Are You Being Scammed By Your Web Design Company?

This is a growing concern amongst many business owners. Does... Read More

Easy Steps To Website Development and Promotion

One of the most important parts of establishing a new... Read More

Having a Domain Name And Web Site Gives Your Business The Key To The Door

Just like all things in life, the ways to run... Read More

How Disabled Users Access The Internet

In 1995 a new era of accessibility for disabled people... Read More

premium house cleaning Park Ridge ...