Troubleshooting
Why does my export show black in Photoshop?
The premultiplied alpha problem explained — and why NSS exports a real checkerboard instead.
The problem
You export a PNG with a transparent background. You open it in Photoshop. Instead of seeing a checkerboard, you see a black background. The subject has a dark halo around it. Nothing you do seems to remove it.
This is one of the most common frustrations with free background removal tools — and it has a specific technical cause.
What causes it: premultiplied alpha
Every pixel in an image has four values: Red, Green, Blue, and Alpha. There are two ways to store these:
Straight alpha (correct):
The R, G, B values represent the actual colour of the pixel. The A value represents how transparent it is. They're independent. A pixel that is 50% transparent still has its full, original colour in R/G/B.
Premultiplied alpha (problematic):
The R, G, B values have already been multiplied by the alpha value during encoding. A pixel that is 50% transparent has R, G, B values that are half what they should be. A pixel that is fully transparent (alpha = 0) has R = G = B = 0, regardless of what colour it actually was.
When Photoshop opens a premultiplied PNG, it reads those zeroed-out RGB values and shows them as black. The transparency data is correct, but the colour data under transparent pixels is wrong.
Why other free tools produce premultiplied alpha
Most canvas-based export pipelines (browser Canvas, some image processing libraries) produce premultiplied alpha by default because it's the format GPUs historically preferred internally. The tools simply don't take the extra step to convert back to straight alpha before writing the file.
How NSS fixes this
NSS never premultiplies. Throughout the entire pipeline:
- The mask is stored as a
Float32Arrayof values between 0.0 and 1.0 - The original RGB values are preserved separately and never modified by the alpha
- At export time, the final pixel is written as:
R = original_R,G = original_G,B = original_B,A = round(mask * 255)— neverR = original_R * (mask). - Even at alpha = 0, the original RGB values are written (not zeroed)
- After encoding, the file is decoded and verified: 100 pixels are sampled, and the alpha values are confirmed to be non-binary and non-zeroed where the mask was partially transparent
If the integrity check detects any premultiplied alpha, you'll see a warning before the download.
The test
To confirm your exported PNG has straight alpha:
- Export a PNG from NSS
- Open it in Photoshop (File → Open)
- You should see a checkerboard behind your subject — no black, no dark fringe
If you see a checkerboard, straight alpha is working correctly.
AVIF and WebP
The same principle applies to AVIF and WebP exports. NSS explicitly disables premultiplication when encoding AVIF (via the @jsquash/avif library setting). WebP via Canvas toBlob uses straight alpha natively.