FIELD NOTE / IMAGE SYSTEMS

How to Compress Images for the Web Without Blurry Results

A browser-first process for resizing, encoding, delivering, and testing web images without soft text, muddy texture, or wasted pixels.

01100VISUAL QUALITY / DELIVERY WEIGHT
Browser-like frame showing a measured image landscape and delivery marks

Short answer: resize an image for the space it will occupy, encode several candidates from a trusted master, let the browser choose with accurate responsive markup, and inspect the delivered result in the page. Blurriness usually comes from an undersized source, aggressive encoding, repeated re-exports, or CSS stretching;not from compression alone.

Measure the slot before exporting

Open the actual layout at its supported breakpoints and measure the image’s CSS width. A card may be 320 pixels on mobile, 420 in a tablet grid, and 600 in a desktop layout. Those values are more useful than generic labels such as small, medium, and large. Add room for device pixel density only where sharper output is visibly useful.

Avoid a candidate for every 50 pixels. Each unique width creates storage, processing, cache, and testing overhead. A short ladder that covers the real slots normally gives the browser enough choice without exploding the derivative count.

Resize from the master once

Always create delivery sizes from the best available source. Enlarging a thumbnail cannot restore detail, and repeatedly saving a lossy file compounds damage. Use a high-quality resize filter, preserve aspect ratio unless an intentional crop is required, and apply modest output sharpening only after testing. Sharpening can create halos that look crisp in isolation and harsh in the page.

Keep art direction separate from resolution switching. If mobile needs a tighter crop, provide a different source through picture; do not expect a smaller copy of the wide desktop composition to communicate the same subject.

Encode by image type

Photographs usually tolerate a tested lossy output. Screenshots with small text need more care and may be better as a palette PNG or lossless WebP. Illustrations with transparency require alpha-edge checks. Compare WebP and AVIF against a solid JPEG fallback at the same dimensions and equivalent visual quality, not identical numeric settings.

Review gradients, facial detail, product texture, and high-contrast edges. A file can look sharp at natural size yet reveal damage when the interface supports zoom. Conversely, a defect visible only at extreme inspection may not justify sending substantially more bytes to every reader.

Write honest responsive markup

srcset describes the intrinsic widths of available candidates. sizes tells the browser how wide the slot is expected to be under layout conditions. If sizes claims the image is 100 viewport widths when it actually occupies half a desktop grid, the browser may choose a needlessly large file. Use values derived from the CSS, then confirm which URL is requested.

Include width and height attributes that express the aspect ratio so the browser can reserve space. CSS can still make the image responsive. The attributes are not instructions to display at that fixed size; they are important layout information.

Load the right images at the right time

Do not lazy-load an image that is likely to be visible immediately and become the Largest Contentful Paint element. Keep it in initial HTML, consider fetchpriority="high" when evidence supports the hint, and avoid hiding its URL behind late JavaScript. Images below the fold are good candidates for native lazy loading.

Compression cannot repair a late discovery chain. Use the network waterfall to separate server delay, resource discovery, transfer time, and render delay. That prevents endless quality reductions when the real problem is markup or scheduling.

Verify the result in context

At mobile and desktop widths, inspect the selected candidate, natural dimensions, rendered dimensions, transfer size, content type, and cache status. Confirm that the image is complete and not stretched. Compare visual details against the acceptance notes, not memory. Then repeat once with a cold cache and once with a warm cache.

The reliable workflow is simple: measure, resize, encode, declare, deliver, and inspect. Skipping the first or last step is how web images become either blurry or needlessly heavy.

Field checklist

  • Measure the CSS slot at each layout breakpoint.
  • Export only a useful set of candidate widths.
  • Keep likely LCP images eager and discoverable.
  • Set width and height attributes to reserve space.
  • Inspect the chosen resource in browser developer tools.

Continue the workflow

Primary references