The original control

We authored a 240 × 120 indexed image with three equal stripes. Palette indices 0, 1 and 2 mapped to teal (21, 127, 124), coral (244, 123, 82) and gold (242, 193, 78). We saved two-bit palette indices with tRNS bytes 255, 128 and 0. We then decoded that file to RGBA and saved the result as a truecolor RGBA control.

P mode: no separate A band
Results from our authored fixture and the exact comparison described below.

What the saved files measured

Pillow reported bands [P] for the indexed file and [R, G, B, A] for the control. Source samples decoded to (21, 127, 124, 255), (244, 123, 82, 128) and (242, 193, 78, 0). The actual tRNS bytes were ff8000. Comparing both complete decoded RGBA grids found zero changed pixels.

Original test fileDetected format / modeDimensionsBytesDistinct decoded RGBA values
indexed-alpha.pngPNG / P240 × 1202143
rgba-control.pngPNG / RGBA240 × 1204583

These are source-file measurements made with Python 3.12.14, Pillow 12.3.0 and libwebp 1.6.0. The manifest records complete file hashes, decoded RGBA hashes and the relevant coordinates. File sizes are measured bytes for these inputs, not forecasts for other images.

How to interpret this comparison

The file’s storage mode and the decoded sample representation are different layers. Looking only for an A band in P mode would miss transparency attached to palette entries. Converting to RGBA made the same per-pixel alpha values explicit in our control; it did not invent transparency. The full-grid equality establishes that distinction for these original files.

Original experiment file previews on white, with detected formats and dimensions
These are previews of authored test files, composited on white for the diagram where necessary. They are not screenshots of a browser test.

Repeat this exact test

  1. Run the indexed transparency case and read the saved indexed_chunks tRNS field.
  2. Compare the three RGBA sample tuples and the bands arrays for both files.
  3. Use changed_rgba_pixels to verify the control preserved every decoded pixel, rather than judging transparency by a filename or mode letter alone.

Download and unpack the ZIP. With Python and Pillow installed, run the command below. Compare the generated measurements.json with the included report. The script regenerates fixtures and computes the measurements; it does not obtain values from this article.

python reproduce.py --case indexed-png-transparency --out rerun

Scope and limits

We did not measure a browser color picker’s composited output. The fully transparent gold has stored RGB but contributes no visible foreground in an ordinary composite. This case concerns indexed palette transparency, not PNG quantization or unused palette entries.

Our own sample is a diagnostic control. Applying its conclusion to another file requires checking that file and the operations performed on it. We have not measured a global error rate or established that an automatic palette is an exhaustive list of image colors.

Does a P-mode image prove there is no transparency?

No. This P-mode fixture carries the transparency table ff8000, and its decoded sample tuples include alpha 128 and alpha 0.

Watch the source-file comparison

Original diagrams and synthetic English narration. Caption sentence timings are approximate.