> [Site index](https://perfectvector.com/llms.txt) — available pages and descriptions.

# Indexed PNG vs. RGB PNG: Check Color and Alpha

> Tell indexed PNG from RGB and RGBA PNG, check palette transparency, and see why changing the mode cannot restore a color removed from the palette.

Source: https://perfectvector.com/blog/indexed-png-vs-rgb-png

Language: en
Author: Irene Kim
Published: 2026-11-25T08:00:00+09:00

An **indexed PNG** stores a palette number for each pixel. A **truecolor PNG** stores the RGB color samples for each pixel, with an optional alpha channel in the RGBA variant. A small palette can store flat artwork exactly if it includes every color and opacity combination the artwork uses. Converting indexed PNG to RGBA preserves the combinations still in the file. Colors discarded during palette reduction are already gone. [W3C PNG format specification](https://www.w3.org/TR/png-3/)

For a logo you plan to trace, check the decoded colors, the edge opacity, and any small details first. An indexed file can be a perfectly good source. The decision changes if a previous export dropped an accent or replaced a smooth edge with patterned pixels.

## Read the PNG color type

PNG records its **color type**, the pixel storage format, in the `IHDR` header. For the three formats in this comparison:

| IHDR color type   | What each pixel stores                       | How transparency can be stored                             |
| ----------------- | -------------------------------------------- | ---------------------------------------------------------- |
| 2, truecolor RGB  | Red, green and blue samples                  | Optional `tRNS` identifies one fully transparent RGB value |
| 3, indexed color  | An index into a palette of up to 256 entries | Optional `tRNS` gives alpha values to palette entries      |
| 6, truecolor RGBA | Red, green, blue and alpha samples           | Alpha is stored per pixel                                  |

A `PLTE` chunk by itself does not identify an indexed PNG. The PNG format also permits a suggested palette in a truecolor file. Read the color type first. [PNG chunk definitions](https://www.libpng.org/pub/png/spec/1.2/PNG-Chunks.html)

Use a small script to check the header of a valid PNG. This reads the type without relying on the color mode chosen by an editor when it opens the file.

```sh
python3 - image.png <<'PY'
import sys

with open(sys.argv[1], "rb") as source:
    header = source.read(26)
if len(header) < 26 or header[:8] != b"\x89PNG\r\n\x1a\n" or header[12:16] != b"IHDR":
    raise SystemExit("Expected a PNG header")
print("PNG color type:", header[25])
PY
```

## Compare the visible pixels before you trace

The same badge can decode identically from indexed and RGBA files. In our 96 × 64 pixel fixture, the palette held four entries: transparent, opaque teal, opaque amber, and half-opaque teal. ImageMagick found zero differing pixels between the indexed and RGBA files. The sample on the teal edge retained an alpha value of 128 out of 255.

Then we replaced the amber palette entry’s pixels with teal and saved the reduced copy as RGBA. The accent stayed teal. Changing the storage format could carry the current pixels forward, but the missing color had to come from a better source. [ImageMagick Compare](https://imagemagick.org/script/compare.php)

![Matching indexed and RGBA PNG badges beside a reduced version whose amber accent remains missing after RGBA export](https://perfectvector.com/blog/indexed-png-vs-rgb-png/workflow-proof.webp)

*The indexed and RGBA copies preserve the same four pixel values. Removing the amber color before export leaves the accent missing.*

If you have two exports from the same source, compare copies at the same pixel dimensions. The command below counts differing pixels in the two decoded images under the default exact comparison.

```sh
magick compare -metric AE indexed.png rgba.png null:
```

Inspect the image on a light and a dark background when transparency matters. If the mismatch is visible around the edge, the [white halo guide](https://perfectvector.com/blog/png-white-halo) helps distinguish baked light pixels from transparency. For printing, a [semitransparent PNG pixel check](https://perfectvector.com/blog/dtf-semi-transparent-pixels) helps identify partial alpha separately from opaque and transparent regions.

## Decide which PNG to trace

Keep the indexed file when the necessary edge and color details are present. If another editor requires RGBA for the next operation, expand a copy and verify that the alpha stayed intact. When you see a lost accent or heavy dithering, compare against the original artwork or the least processed export you can get. The [PNG-to-SVG quality guide](https://perfectvector.com/blog/png-to-svg-without-losing-quality) shows which source details to inspect before tracing.

## FAQ

### Is indexed PNG lossy?

PNG compression preserves the stored pixels. Choosing a limited palette can change the artwork before compression if some original colors or opacity levels cannot be represented.

### Can indexed PNG have partial transparency?

Yes. It can assign a different alpha value to each palette entry. The semitransparent teal in the example has its own entry.

### Will converting indexed PNG to RGBA restore missing colors?

No. RGBA expansion changes how the current pixels are stored. Recover the original artwork or re-export from the source project if an earlier palette reduction removed needed colors.

## Start with the best available copy

PerfectVector can trace a PNG into editable SVG paths.

If you need editable artwork from a PNG, [preview a vector trace](https://perfectvector.com/image-to-vector) with the version that retains the correct edges and colors. Compare the traced accent and openings with the source before you use the SVG.

## Sources

1. [W3C PNG specification](https://www.w3.org/TR/png-3/) — PNG color types, palette storage and alpha.
2. [PNG chunk specifications](https://www.libpng.org/pub/png/spec/1.2/PNG-Chunks.html) — The IHDR, PLTE and tRNS chunks.
3. [ImageMagick Compare](https://imagemagick.org/script/compare.php) — Pixel differences and the absolute error metric.

## Explore

- [Read the HTML article](https://perfectvector.com/blog/indexed-png-vs-rgb-png)
- [Why the PNG gAMA Chunk Changes Image Brightness](https://perfectvector.com/blog/png-gamma-chunk.md)
- [Read PNG pHYs to Check Print Size and Resolution](https://perfectvector.com/blog/png-phys-print-size.md)
- [Product facts](https://perfectvector.com/product-facts.md)
- [FAQ](https://perfectvector.com/faq.md)
- [Pricing and credits](https://perfectvector.com/pricing.md)
