01

Why transparent areas need a decision

If transparency is flattened without an explicit background, the visible result can become black or inconsistent. The converter uses a predictable white matte for JPEG.

02

Choose the right output

Keep PNG for lossless interface graphics, logos or exact alpha. Consider WebP for smaller modern output. Use JPEG only when transparency is unnecessary or a matte is acceptable.

03

What an alpha channel represents

Alpha stores opacity separately from red, green and blue. A pixel can be fully opaque, partially transparent or fully transparent. Those states matter for logos, overlays, interface assets and cutouts.

JPEG has no alpha channel. A converter must choose a background before encoding rather than allowing transparent areas to become unpredictable black, white or another browser-dependent result.

Key points
  • Alpha 255: opaque
  • Alpha 128: partially transparent
  • Alpha 0: transparent
  • JPEG: no alpha storage
04

Design of the controlled graphic

The test image contained opaque color, a semi-transparent edge and a fully transparent area. That catches more mistakes than a graphic with only transparent and opaque pixels because premultiplication and edge blending can affect the middle state.

The same source was requested as PNG, WebP and JPEG. Successful outputs had to match the requested MIME and reopen at the expected dimensions.

05

Observed format behavior

PNG preserved the alpha states. WebP preserved transparency when the release browser encoder supported the path. JPEG received a deliberate white matte because the format cannot represent alpha.

The wording “when supported” is important for WebP and other browser encoders. A requested format is not considered successful until the returned bytes confirm it.

06

Why edge inspection matters

A logo can retain transparency yet develop dark or light halos if RGB values under transparent pixels were blended against the wrong matte. Inspect semi-transparent boundaries over both light and dark backgrounds.

For exact interface assets, keep the lossless source and compare at native size. A small byte saving is not worthwhile if it introduces visible fringes.

07

Choose PNG, WebP or JPEG

Use PNG when exact lossless pixels and alpha are important. Test WebP for smaller modern delivery. Use JPEG for photographs or assets where a fixed background is acceptable.

If a transparent graphic must become JPEG, let the user choose or clearly state the matte. Silent flattening makes the output hard to trust.

08

Limits of the single-fixture test

The controlled graphic covers three alpha states but not animated transparency, every bit depth or every color profile. Complex gradients and compositing modes deserve additional visual tests.

The result verifies the product’s explicit handling rule. It does not claim equal perceptual quality or byte efficiency across formats.

09

How to detect an accidental matte

Place the converted asset over a checkerboard, pure white and a dark background. A correctly preserved transparent edge should blend with each background; a flattened asset will keep one fixed color around or behind the subject.

Also inspect the output metadata and format signature. A file can look acceptable on white while still being mislabeled or losing transparency that another layout needs later. Preserve the PNG master and treat flattened JPEG as a destination-specific derivative.

For automated regression, sample known pixels from the opaque, half-alpha and transparent regions after decoding. Visual review still matters because a few pixel probes cannot reveal every edge halo or gradient problem.

Repeat the comparison after resizing, because interpolation can alter semi-transparent boundaries even when the output format supports alpha correctly.

Key points
  • Test light and dark backgrounds
  • Inspect semi-transparent edges
  • Sample known alpha regions
  • Verify actual format
  • Keep the alpha master
  • Do not overwrite the source
  • Check gradients after resizing
  • Document the chosen JPEG matte color

What this does not prove

A metadata result describes the fields and structures that the supported parser could read. It does not, by itself, prove authenticity, intent, authorship or the truth of the visible scene.

Sources