Why PNG Transparency Turns Black or White

November 08, 2026 · PNG.now Editorial · PNG Troubleshooting

Diagnose alpha loss, matte colors, premultiplied alpha and destination formats without transparency.

Why PNG Transparency Turns Black or White

You export a PNG with a clean transparent background. You open it in a photo viewer, a design app, or a web browser—and the transparent areas are now solid black or solid white. The image looks broken, but the file is not corrupted. This is a collision between how transparency is stored in a PNG and how the receiving application interprets that data.

This article covers three causes for the black/white shift, what you can check in your own file, and what you can and cannot fix after the fact.

Three Causes: Missing Alpha, Matte Color, and Premultiplied Alpha

1. Missing or Stripped Alpha Channel

A PNG stores transparency in an alpha channel, a separate grayscale layer that defines per-pixel opacity. When you see black or white where transparency should be, the first diagnostic is whether the alpha channel survived the save or conversion.

  • How to check: Open the PNG in a tool that shows channel data (e.g., Photoshop, GIMP, pngcheck). Look for a fourth channel labeled "Alpha" or "Transparency." If only RGB channels exist, the file has no transparency data—the "transparent" pixels were filled with a solid color during export.
  • Why it happens: Many image editors and conversion libraries default to stripping the alpha channel when saving as PNG, especially if the output format is specified as "RGB" instead of "RGBA." The PNG specification defines color types 4 (grayscale with alpha) and 6 (truecolor with alpha) as the only types that carry transparency (PNG 3rd Edition, §4.1.1). An export that writes color type 2 (truecolor, no alpha) silently discards the alpha data and fills transparent pixels with a matte color (see next section).

2. Matte Color and the "Checkerboard" Assumption

Even when the alpha channel is present, the RGB values under fully transparent pixels are often non-zero. Many image viewers and compositing engines display a matte color—a background color chosen at export time—when no background is provided.

  • How to see it: Open the PNG in a hex editor or a pixel inspector. Navigate to an area that should be fully transparent (alpha = 0). The red, green, and blue values will be something like (255, 255, 255) for white or (0, 0, 0) for black. Those values are not visible when the alpha channel is respected, but they become visible if the alpha channel is ignored or if the viewer renders the image without compositing.
  • Why it happens: When an application exports a PNG with transparency, it may fill the RGB channels of transparent pixels with a matte color—often the background color of the canvas (white) or the color of the eraser tool (black). This is an optimization for older software that cannot handle alpha. The PNG spec does not mandate a specific matte color; it is an application-level decision (PNG 3rd Edition, §12.5 discusses background color display, but not matte fill during export).
  • The failure mode: If you then open that PNG in a program that does not read the alpha channel (or mistakenly treats the file as RGB-only), it will display the matte color instead of transparency. The result: "transparent" areas appear as solid white or solid black.

3. Premultiplied Alpha vs. Straight Alpha

PNG natively uses straight alpha (sometimes called "non-premultiplied" or "independent" alpha): each pixel stores (R, G, B, A) where the RGB values are the true colors, and A is a separate opacity value. Some applications, particularly game engines, video codecs, and macOS compositor, expect premultiplied alpha: RGB values are multiplied by the alpha value before storage.

  • How to tell: In a premultiplied file, a fully transparent pixel (alpha = 0) will have RGB values that are all zero—so it appears black when the alpha is ignored. A semitransparent pixel with 50% opacity will have its RGB values halved. If you open a premultiplied PNG as straight alpha, the colors will look darker or washed out, and transparent areas will be black.
  • Hard limit: PNG does not officially support premultiplied alpha. The spec warns that "premultiplication of alpha is not recommended" (PNG 3rd Edition, §4.4). However, some tools (e.g., Adobe Photoshop with "Transparency" blending mode, or certain export plugins) write premultiplied data into the RGB channels while keeping the alpha channel intact. The file passes format validation, but the visual result is wrong in any straight-alpha viewer.

Diagnostic Steps

Step 1: Inspect the Color Type and Alpha

Use a tool like pngcheck (command line) or a hex viewer. Look at the IHDR chunk. The color type field (byte at offset 25 in the file) tells you everything:

  • 0 = grayscale, no alpha
  • 2 = truecolor, no alpha
  • 4 = grayscale with alpha
  • 6 = truecolor with alpha

If the value is 2, the file has no transparency—period. The black or white you see is the matte color that was baked in during export. If the value is 6, the alpha channel exists; the problem is likely matte color or premultiplication.

Step 2: Check the RGB Values of Transparent Pixels

Open the PNG in a pixel-level editor (e.g., GIMP's "Pixel Art" mode, or a Python script with PIL). Select a pixel with alpha = 0. Read its RGB values:

  • If they are all 0 → likely premultiplied alpha or a black matte fill.
  • If they are all 255 → a white matte fill.
  • If they vary (e.g., (128, 64, 0)) → the matte color was the background of the source image, or the alpha was premultiplied with a non-neutral background.

Step 3: Test in a Known Good Viewer

Open the same PNG in two different applications: a web browser (Chrome, Firefox—both handle straight alpha correctly) and an image editor that shows the checkerboard (GIMP, Photoshop, or macOS Preview with a checkerboard overlay). If the browser shows transparency (checkerboard) but the editor shows white, the editor is likely applying a matte background. If both show black, the alpha channel is missing or premultiplied.

What Conversion Cannot Recover for Why PNG Transparency Turns Black or White

  • If the alpha channel was stripped (color type 2): The transparency information is gone. The matte color that replaced it is permanent. No amount of "remove background" or "transparency recovery" can restore the original per-pixel opacity—it was never saved. You must return to the source file and re-export with color type 6.
  • If premultiplied alpha was baked in: You can attempt a reverse-multiply (divide RGB by alpha for each pixel), but this amplifies quantization noise in low-alpha regions. For fully transparent pixels (alpha = 0), the original RGB values are lost—they were multiplied by zero and are now zero. You cannot recover the original color under a fully transparent pixel. The best you can do is set those pixels to a neutral matte color (e.g., (0,0,0) or (255,255,255)) and accept the loss.
  • If the file has a tRNS chunk (transparent color) instead of an alpha channel: Some older or simpler PNG encoders use a single transparent color (tRNS) instead of a full alpha channel. This works for images that need only one transparent shade, but it is not per-pixel transparency. If the viewer does not respect tRNS, the transparent color will appear as its RGB value. The PNG spec (§4.2.2.3) defines tRNS as a "simple transparency method" that is not equivalent to an alpha channel.

How to Prevent Black or White Transparency on Export

  • Always choose color type 6 (truecolor with alpha) in your export settings. In Photoshop, that means saving as PNG-24 with "Transparency" checked and "Convert to sRGB" unchecked. In GIMP, ensure "Save color values from transparent pixels" is enabled. In command-line tools like pngquant or optipng, use the --alpha flag to preserve the alpha channel.
  • Avoid matte fill options. In Adobe tools, the "Matte" dropdown (often set to "None" or "White") determines what fills transparent pixels in the RGB channels. Set it to "None" to preserve zeroed RGB values (which will appear black only if alpha is ignored, but at least the matte color is neutral and predictable).
  • Do not use premultiplied alpha in PNG. If your workflow requires premultiplied alpha (e.g., for a game engine), convert to a format that explicitly supports it (like TIFF with premultiplied alpha, or a raw RGBA buffer). Do not force it into a PNG.

When You Are Stuck with a Broken PNG

If you have a PNG that shows black or white transparency and you cannot re-export from the source, you have two limited options:

  1. Manual repair (if alpha channel exists but matte color is wrong): Use an image editor to set all pixels with alpha = 0 to a uniform RGB value (e.g., (0,0,0) for black matte, (255,255,255) for white matte). Then, when the file is viewed in an application that ignores alpha, the transparent areas will at least be a single solid color instead of a ragged mix. This does not restore transparency; it only makes the file predictable.

  2. Alpha re-mapping (if premultiplied): Use a script to divide each pixel's RGB by its alpha value (clamping to 0–255). Then re-save as straight alpha. This works for pixels with alpha > 0, but fully transparent pixels (alpha = 0) will remain black. You can then set those to a neutral matte color.

Neither method recovers lost data. The only reliable fix is to go back to the original source and export correctly.