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

scheduled cleaning services Mundelein ...
In The News:

United Airlines is blocking unauthorized AI travel agents from its booking systems, warning that automated purchases could put MileagePlus miles at risk.
Apple's macOS 27.3 beta 2 adds new Mac security controls for AI agents, letting you pick specific protected folders instead of granting Full Disk Access.
Google's AI used smartwatch sensors to spot hypertension without a blood pressure cuff, but the Nature study found it missed about 1 in 3 cases.
The FBI warns the ARTEX AI hacking tool can give criminals privileged access in under three hours, targeting Microsoft 365 and financial firms.
The FDA-authorized Virtuoso Endoscopy System uses needle-sized robotic arms to remove bladder tumors intact, helping pathologists assess detrusor muscle.
Identity theft restoration involves credit freezes, fraud alerts and disputing fraudulent records. Here's how the recovery process works, step by step.
Genesis AI raised $500 million to expand its general-purpose robot Eno, which learns physical skills from workers wearing special electronic gloves.
JPMorgan Chase says hackers accessed marketing data at third-party vendors as an extortion group leaks records tied to Visa and Mastercard customers.
Uber Parking launches in 15 U.S. cities after the SpotHero deal, offering upfront prices, Uber One credits, and a future role for robotaxis in garages.
The Fox News AI Newsletter covers the latest artificial intelligence technology advancements, including the challenges and opportunities AI presents now and for the future.
Microsoft Outlook flaw CVE-2026-124194 lets a malicious .msg file expose NTLMv2 authentication data, and Microsoft confirms hackers already exploited it.
Former Secret Service cyberfraud investigator Jason Brown warns AI voice cloning scams could trick families into losing thousands of dollars this holiday season.
A single data broker opt-out may not be enough. Spokeo, Whitepages and BeenVerified can still expose your address and family details to scammers.
Apple Photos now embeds an invisible SynthID watermark in images edited with Apple Intelligence tools like Clean Up, Extend and Reframe in iOS 27.2.
Fortra researchers say fake vacation rental sites use live customer support chats to trick travelers into handing over credit card details this holiday.
Ecolab CEO Christophe Beck says AI data centers could drink as much water as Americans by 2030 unless direct chip cooling and water recycling catch on.
Ring's Drone Cam flies room to room with AI navigation, 2K video and a $249.99 price, but it still awaits FCC authorization before it can ship in the U.S.
Virginia's GPS speed limiter program is already active for reckless driving offenders, but early users report glitches that apply wrong speed limits.
VPN split tunneling lets your banking app skip the encrypted tunnel while other apps stay protected, and the Allow LAN setting can fix printer issues.
A fake E-ZPass email cites a real federal regulation to demand toll payments, but the law it references has nothing to do with collecting tolls.
A credit freeze, fraud alert and identity monitoring each protect different parts of your financial life after a data breach. Here's how to choose.
OpenAI's new classifier flags 48% fewer images for review while detecting similar levels of CSAM, and ChatGPT now suspends users for 24 hours.
USF researchers built an AI mosquito trap with over 98% accuracy as Florida battles its largest dengue outbreak in decades with 524 local cases.
Fake OpenAI event pages promise free ChatGPT Pro subscriptions, then trick employees into handing over Microsoft and Google account credentials.
Ford's new privacy promise pledges not to sell driving data to insurers or brokers, but disabling connected car data sharing could cost you key features.

Art, Artists and the Web: Part 4--What to Do After a Website is Designed

What to do if you are an artist after you... Read More

How Your Own Website Helps Your Small Business Grow

What do you mean, you don't have a website for... Read More

How Improving Your Sites Usability Can Increase Your Buyers by 40% and Boost Each Order By 10%!

With all of the factors involved in designing and building... Read More

Get to Know People through Websites

Web sites are not just places to sell things; they... Read More

Traffic for Webmasters

"If you build it, they will come"; is an age... Read More

Study Your Sites Performance Via Hit Tracking

Knowledge is power.And undoubtedly, it is the key to making... Read More

Server Stats ? Analyzing Traffic To Your Site

Analyzing traffic to a site is a key factor in... Read More

Establishing Your Web Presence

Part of the success of most home-based businesses is their... Read More

17 Tips to Plan a Website

Everyone wants one.Everyone wishes they knew how to make one.SOME... Read More

What and How to choose the Right Keywords for Mega Traffic

Keywords in Search Engine Optimizing and Search Engine Marketing are... Read More

Improve Web Sales Figures Forever And Ever Amen!

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

Tell me what your website does!

You know exactly what your organisation does and what your... Read More

Abandonment - Why Visitors Don?t Turn Into Customers

Every good Internet business understands the value of conversions versus... Read More

Duplication vs. Individualism

How can we add Word Rich Content to our Websites... Read More

Do You Really Need A Website To Succeed

Rosalind wants to share her inspirational poetry with a wider... Read More

The Importance of Website Stats to You

One of the best tools you have as a webmaster... Read More

Why Your Business Needs a Website

Even with the steady growth of the World Wide Web,... Read More

Developing State-enabled Applications With PHP

Installment 1Developing State-enabled Applications With PHPWhen a user is browsing... Read More

Freelance Programming is Easy to Manage

There are several reverse bid freelance sites out there. Beyond... Read More

5 Essential Traits Of A Home Business Website

So you've decided to start an online work at home... Read More

Web Analytics - Getting it Right

Understanding and using web analytics.In recent years, website marketers were... Read More

2 Key Ways to Make Your Site a Success

If one more business owner tells me their website sucks... Read More

Setting Up A CGI Script On Your Web Site

Before you set up any scripts you will need some... Read More

Top 7 Reasons Why Your Business Needs a Website

A website provides invaluable advantages for businesses who have one.7... Read More

Instant Relevant Web Site Content - No Its Not a Bot

In about the Time it takes to Watch a Reality... Read More

tidy up service Winnetka ...