Why AI Images Lose Transparency on Your Website

If an AI-generated image shows a white rectangle after upload, compare two versions of the file: the original source and the server response to the image request from the product card. The alpha channel determines pixel transparency. If the source contains transparent pixels but the browser-delivered version is fully opaque, check the export, thumbnail generation, and CDN transformations. If transparency exists in both versions, the cause may be a white background on the component or opaque pixels around the object itself.

This FAQ is for content managers and e-commerce developers. The example is a single item in a storefront, where the card background may be light or dark and the image is displayed in several sizes. The verification workflow applies to static PNG, WebP, and JPEG files. The documentation was checked on November 27, 2026. The files and Python snippet were tested locally on synthetic data.

How can you tell a white rectangle from the site background?

Place two contrasting colors under the image. If the empty area around the object changes along with the background, the pixels in that area at least partially let the background show through. If the rectangle stays white, the white color may be in the file itself or in a separate element between the image and the background. The principle of layering an image over a background is described in the W3C composition specification.

Imagine an orange thermos with a handle loop. Check both the corner of the image and the opening inside the loop. If the corner is transparent but the opening is filled with white, the file has working transparency, but the cutout does not follow the full required outline. If the entire field stays white, open the exact server-delivered file in an editor with a switchable background. This step helps separate the page effect from the image content. Viewing the result on a white page is not enough, because an opaque white background and a transparent background over a white page look the same.

Checkerboard patterns can also be drawn as ordinary pixels. This is especially important for generated results: a grid that looks like a transparency indicator in an editor may actually be part of the artwork. If the grid is visible on both backgrounds and the corresponding pixels have an opaque alpha value, go back to generation, export, or background removal. For working with the source photo, there is a separate guide to background and edge removal with rembg.

Why can a PNG have a white background?

The extension .png refers to the file name format, while transparency depends on the content. A PNG can store a separate alpha channel or transparency data through a tRNS, for example for colors from an indexed palette. A PNG can also be fully opaque. Even with RGBA, all alpha values may be at their maximum. The presence of the letter A in the image mode does not by itself confirm a transparent background. PNG Specification, Third Edition.

For a standard 8-bit alpha channel, 0 means fully transparent and 255 means fully opaque. Intermediate values are needed, for example, for a soft edge or a semi-transparent shadow. The minimum and maximum value range shows whether the file contains opaque and transparent areas. You need to check the location of those areas separately. Transparency in only one corner can leave almost the entire old background around the thermos.

Image creation and saving also use different parameters. For example, the OpenAI Images API reference describes background=transparent for models that support this capability and requires PNG or WebP for this result. As of the verification date, the list of explicit support includes gpt-image-2.5-sunburst and gpt-image-2.5-flareFor gpt-image-2 the documentation separately notes a preview status for transparency support. Conditions depend on the exact model identifier, and the final file still needs to be opened and checked. OpenAI Images API image creation parameters.

Where do you get the file the shopper actually saw?

Open the specific product card and wait for the image to appear. In Chrome DevTools, on the Elements tab, select the needed img, then in Console read its $0.currentSrc. In Chrome, the $0 points to the element selected in the panel. The currentSrc property shows the current image URL. On a page with picture or srcset it may differ from the srcattribute you see in the template. HTML Living Standard image selection and Chrome DevTools console utilities.

On the Network tab, find the request to that URL. If the request is not recorded, open the panel before reloading the page. When diagnosing, it helps to disable cache in DevTools and repeat the load with the panel open. Record the product variant and angle, the window width, the URL, and the Content-Type. The latter helps show what format the server declared. To check alpha, you need the response bytes. Download the delivered resource or reproduce the same request in an authorized environment with the same transformation parameters and format negotiation headers. On a storefront with session-based access, do not share the command with cookies and internal headers with other people. Chrome DevTools help for network requests.

It is important to verify the same slot. The main image, the mobile image, and the small thumbnail may use different URLs or transformations. If the image is set through CSS, instead of the currentSrc property for img check the computed background-image and the request for the corresponding resource. Also make sure you are examining the photo for the selected variant, not the image from the previous color that remained before loading finished. How to tell the difference between the main photo and a thumbnail in the same gallery is shown in the article on product photos and accessible names.

Opening the same address in a new tab can return a different response. For example, Cloudinary describes changing automatic format selection by the Acceptheader, which can differ for an image inside a page and during direct navigation. This is an example of one provider's behavior. First compare the actual responses from your storefront, then change the transformation rules. Cloudinary documentation on format negotiation.

How do you check the alpha channel in two saved files?

For static files, you can decode both through Pillow, convert the pixels to RGBA, and count three groups. Conversion is important for paletted PNGs: transparency can be defined there even when the mode is P. The script below prints the detected format, the source mode, the size, and the number of fully transparent, partially transparent, and opaque pixels. Run it as python alpha_check.py original.png delivered.webp in an environment with Pillow. Pass the actually saved files as arguments; the extensions may differ. convert, getchannel, and histogram methods in the Pillow documentation.

from pathlib import Path
import sys

from PIL import Image

for filename in sys.argv[1:]:
    path = Path(filename)
    with Image.open(path) as image:
        if getattr(image, "n_frames", 1) != 1:
            raise ValueError(f"Expected a still image: {path.name}")
        alpha = image.convert("RGBA").getchannel("A")
        counts = alpha.histogram()
        print(path.name, image.format, image.mode, image.size,
              "clear", counts[0],
              "partial", sum(counts[1:255]),
              "opaque", counts[255])

The numbers add up to the frame area in pixels. If clear and partial are zero, the file is fully opaque. If opaque and partial are zero, the frame is fully transparent and the object will not appear in it. If clear If the value is greater than zero, inspect the relevant areas as well. For example, you can choose an open area near the outline, a gap in the loop, and a few pixels along the edge. Compare the corresponding areas in each image. You cannot transfer the source coordinates directly to a cropped thumbnail.

Local check. On five training images sized 8 × 8 pixels, we ran this Python snippet with Pillow 12.3.0. Three groups matched the expected values. PNG with alpha and lossless WebP produced identical counters. PNG with palette-based transparency also showed open pixels. PNG in RGBA mode with a solid alpha channel and JPEG on a white background were opaque. The total size of each frame was 64 pixels. This test did not use a browser, CDN, or generator call.

Training file Fully transparent Partially transparent Opaque
PNG with a cutout 39 9 16
WebP, lossless conversion 39 9 16
Palette PNG with a transparent color 48 0 16
PNG RGBA with a solid alpha channel 0 0 64
JPEG on a white background 0 0 64

At what stage should you look for the cause if the source and output differ?

Look for the first step where transparency disappeared. Keep the original export, the uploaded file in the media library, the derived thumbnail if you have access, and the bytes from the browser request close at hand. An unexpected result at one step narrows the list of possible causes. Comparing the final URL with the source filename does not give you that boundary.

Observation Where to check next
The original export is completely opaque Generation settings, layer flattening, export, or background removal
Alpha exists in the media library, but the thumbnail is opaque Derivative generation settings and fill color used during cropping
The file opens transparently from storage, but the response for the card is opaque CDN transformation, format, request parameters, and cache
The received file is transparent, but a white frame is visible in the card CSS backgrounds, overlaid elements, and RGB values near the semi-transparent edge
The problem appears only on mobile The current URL and the selected image variant at the mobile viewport width

WebP supports an alpha channel, so replacing PNG with WebP does not by itself explain a loss of transparency. If the derivative version is actually JPEG, the background has usually already been flattened into an opaque image. When changing formats, regenerate the thumbnail from a file with transparency. Simply re-exporting an opaque version as PNG will not restore the original cutout. WebP container specification.

When diagnosing CSS, change one background layer at a time. If the container background changed, but the inner white area remained while transparent pixels are present in the file, check the background of the element itself img, the nearest wrapper, or the background of a pseudo-element. If the white area is visible even outside the page, the problem is earlier in the chain. This sequence helps avoid template changes when only one export setting needs to be fixed.

Why did the background disappear, but the light halo remain?

A semi-transparent edge has both color and a degree of transparency. If light RGB values remained along with the edge when the old white background was removed, they can show up on a dark background. The file still passes the alpha test correctly. Another possible source is resizing. To tell the causes apart, compare the cutout and the delivered thumbnail on the same dark background. Check them at the card's actual display size and zoom in to inspect the edge. W3C simple alpha compositing rules.

Do not fix the halo by removing all white pixels globally. That can cut out a white label or a highlight on the object itself. If the defect is already in the source, go back to the mask and how it accounts for the object, gaps, and semi-transparent edges. If the source is clean but the thumbnail looks worse, isolate resizing or format conversion. For a useful soft shadow, check the acceptable look on your background colors, especially in dark mode.

How do you make sure the fix reached all card variants?

Define the expected result separately for each slot you use. For example, the large card and the responsive thumbnail should show the showroom color around the thermos, while the illustration for a separate channel may have a deliberately flattened white background. If only one URL was fixed, recheck the variants the browser chooses at a different viewport width or screen density. If the change affected the CDN, make sure the browser is already receiving the new derivative, and repeat the check on the returned bytes.

A convenient minimal example for the team is to save two files from the same angle, the URL and response type for each displayed size, plus a view on light and dark backgrounds. The criterion is simple: in the file intended for the cutout object, the background opens in the agreed areas, the needed details are continuous, and the current URL points to the correct variant. If the background is supposed to be white by design, the opacity of the selected copy may be normal. The goal of the check is to match the file’s intended use.

How the studio helps untangle the image pipeline for a storefront

Vladimir Lomtev’s AI studio can map the path from generation to the website, define export rules for master files and thumbnails, and prepare a pilot image QA flow for a single storefront template. For the first meeting, one object, its source file, and information about which cards are expected to have transparency are enough. Discuss the project.

Bottom line

Start with one image on the storefront and inspect the file that was actually loaded. Comparing alpha with the source will show whether transparency was lost on the way to the browser. Checking the background, edges, and gaps will show whether the image is suitable for that specific place on the page.

Request an audit

Share your contact details and we will follow up.

← All articles

Comments (0)

Loading comments…

Leave a comment
No registration required

Book a strategy call
for agentic operations

Tell us which workflow you want to improve. We will map feasibility, risks, and the fastest MVP path.

By submitting, you agree to our privacy policy

Contacts

Global Operations

Serving U.S. clients remotely
with private cloud and on-prem options

Strategy calls by request

We respond after reviewing your workflow context.

info@agentsunrise.pro

For partnership inquiries

Have a proposal?

Write to us in messengers

© 2026 AgentSunrise