Image workflow
PNG, JPEG, and WebP: choose by image content
A practical comparison of common browser image formats, compression artifacts, transparency, resizing, and repeat export quality.
Format is a content decision
A filename extension does not describe quality by itself. PNG, JPEG, and WebP use different representations and compression strategies. The best result depends on whether the image is a photograph, flat illustration, screenshot, logo, transparent overlay, or a mixture of these.
JPEG is widely suited to photographs and continuous tone but does not support alpha transparency. PNG preserves exact pixel values with lossless compression and is often effective for interface graphics, line art, and images with repeated flat colors. WebP can encode lossy or lossless images and supports transparency, offering another tradeoff rather than an automatic win.
Resize before chasing a quality slider
Pixel dimensions often dominate web delivery cost. A camera image that is several thousand pixels wide remains unnecessarily expensive when it is displayed in a small article column. Create a separate resized copy near the largest rendered size, then tune compression while looking at that output.
Preserve aspect ratio unless stretching is intentional. If the destination requires a different shape, decide whether to crop, pad, or redesign the composition. A resizer cannot infer the important subject, and forcing both width and height can distort faces, circles, text, and product proportions.
Inspect the artifacts that matter
Lossy compression can blur fine texture, create ringing around sharp edges, or break smooth gradients into bands. Screenshots and diagrams may show damage sooner than photographs because small text and one-pixel boundaries are visually important. Compare at 100 percent zoom and at the real display size.
Transparency needs a deliberate check. Converting an image with alpha to JPEG requires a background color, and an unexpected matte may appear around edges. Color profiles and browser encoders can also affect appearance. A visual that looks correct in one editor should still be previewed in the target browser and page background.
Avoid generation loss and preserve the source
Every additional lossy export starts from already simplified pixels and can introduce more damage. Keep the original or a high-quality master, and generate delivery variants from that source rather than repeatedly editing a downloaded derivative.
File size is only one part of performance. Responsive image markup, caching, lazy loading, correct dimensions, and avoiding layout shifts also matter. For a repeatable production workflow, use a build pipeline that records dimensions, formats, and quality settings instead of relying on manual exports that cannot be reproduced.
- Photograph: compare JPEG and lossy WebP.
- Screenshot or line art: compare PNG and lossless WebP.
- Transparency: use a format with alpha support.
- Animation or professional color: verify support in a specialized workflow.