ShrinkWise
Technology
Why Media Compression Changed the Way I Develop Websites

Why Media Compression Changed the Way I Develop Websites

You know that moment when you publish a beautiful website, but it takes forever to load? I've been through that more times than I'd like to admit.

When I started working in web development, I was obsessed with visual quality. I wanted every image to be perfect, every video frame crystal clear. The problem? My websites were beautiful, but slow. Very slow. It was only when I lost an important client who complained that his website took more than 8 seconds to load on mobile that I realized: I needed to understand real compression. And no, I'm not talking about simply "reducing the quality." I'm talking about intelligent optimization.

Website Performance Methics

What Really Happens When You Don't Compress Your Files Let me tell you a true story. Last year, I audited a fashion e-commerce site that had a 67% bounce rate. Sixty-seven percent! People were coming in and leaving immediately. When I looked at the code, I found product images that were 8MB each. Eight megabytes! For a photo that appeared 400px wide on the screen. It was like using a truck to transport a letter.

Understanding Modern Formats (And Why You Should Care)

For years, the web world lived in a love triangle between JPEG, PNG, and GIF. But let's be honest: these formats were born in the 90s. We have much better technology now.


Modern Immats

WebP: The Darling of the Moment

WebP was created by Google, and wow, what a difference it makes. I managed to reduce image sizes by 25-35% compared to JPEG, while maintaining identical visual quality. And you know what's best? It supports transparency (goodbye heavy PNGs) and even animation (bye-bye, giant GIFs).

Real Case: News Portal

I converted all the thumbnails on a news portal from JPEG to WebP. Result: I reduced daily transfer from 4.2GB to 2.8GB. This meant real bandwidth savings and pages loading 40% faster. Users noticed, and Google did too the site climbed 12 positions in organic search results.

Image Optimization Errors That Affect Your Website (and How to Fix Them)

After auditing hundreds of websites, we've noticed that certain image optimization errors are frequently repeated. These are frustrating mistakes, mainly because their solutions are relatively simple, but the impact of ignoring them is enormous: slower websites, poor user experience, and damage to SEO.

Here are the four most common errors we encounter daily and, most importantly, how to avoid them once and for all.

1. Use PNG for Everything

The mistake: The PNG format is excellent for logos, icons, and graphics that require a transparent background. However, using it for product photographs or complex images is a significant waste of resources. A PNG of a photo can be many times larger than an equivalent JPEG or WebP version, with no visible gain in quality.

The solution: Adopt a clear format policy

  • PNG: For graphic elements that require actual transparency only.
  • JPEG/WebP/AVIF: For all photographs, banners, and complex images. Prioritize WebP and AVIF, which offer better compression.

2. Do not specify image dimensions.

The mistake: Publishing images without the width and height attributes in the HTML. This causes the browser to not know how much space the image will occupy until it is fully downloaded. The result is the dreaded Cumulative Layout Shift (CLS): the page content suddenly "jumps" while loading, frustrating users and penalizing your site in search engines.

The solution: Always define the intrinsic dimensions of the image in the code. For responsive layouts, combine width and height with the CSS aspect-ratio property or use modern components/frameworks that manage this behavior automatically.

3. Serving a 4K image as a 200px thumbnail

The mistake: Loading a huge image (e.g., 4000x3000px, 8MB) and simply resizing it via CSS to display it as a thumbnail. The browser is forced to download that entire monumental file to display something that could be a 50KB file. It's inefficient and absurdly expensive for performance.

The solution: Generate multiple versions of the image at different resolutions. Use the HTML attribute srcset to allow the browser to choose the version best suited to the user's screen size. If possible, implement a CDN (Content Delivery Network) with automatic on-demand resizing.

4. Compress, Decompress, and Compress Again

The mistake: A disorganized workflow: the designer saves a JPEG at 80% quality, the developer reopens it and saves it at 70% to "optimize" it, and then a build tool compresses it again. Each recompression in a lossy format (like JPEG) cumulatively degrades the quality, resulting in pixelated images and visual artifacts.

The solution: Establish a linear workflow:

  1. Work with the highest quality originals (RAW, PSD, lossless PNG).
  2. Make the necessary treatments and edits to these originals.
  3. Compress and export to the web ONCE, in the desired final format and size.

What I Learned After Compressing Thousands of Files

Media optimization isn't about sacrificing quality. It's about being smart. It's about understanding that a mobile user with unstable 4G doesn't need the same resolution as a designer on a 5K iMac.

Every project I deliver now goes through rigorous optimization. And you know what's funny? Clients rarely notice the "loss of quality" (because there's no visible loss), but they ALWAYS comment on how fast the website is.

Performance isn't a luxury. It's the foundation of the modern web experience. And intelligent compression is the easiest and most impactful tool in your arsenal.

Ko-fi
Why Media Compression Changed the Way I Develop Websites | ShrinkWise Blog