GPT Image local edits: check the mask and the supposedly unchanged pixels
Edit a product image in Ofox Agent without code, inspect the actual result, and use the original GPT Image API mask experiment for pixel-level checks.
Edit a product image in Ofox Agent without writing code
You can upload a product image to Ofox Agent and describe the change in ordinary language. You do not need an API key, a terminal or a hand-built alpha mask for this conversational route. Sign in to your Ofox account; image generation uses the account’s available balance and is not promised to be free.
On October 13, 2026, we uploaded the same synthetic bottle used below and completed one local-background edit in Agent. Its image tool reported OpenAI: GPT Image 2, 1024 × 1024, medium. The chat model selector and the image-generation model are different: our conversation used GPT-6.1 Sol, while the image tool used GPT Image 2. This new Agent example is separate from the earlier GPT Image 2.5 Flare API experiment; its measurements do not carry over.
1. Attach the original and describe the protected subject
Open a new conversation, use Add attachment (the paperclip), choose your original product image and wait until its attachment is visible. Use a clear image you are authorized to upload. Keep an untouched local copy. For packaging, list the elements you must preserve: silhouette, cap, label text, logo, colors and the product’s position. A written preservation request is an instruction, not a pixel lock.
This is the actual instruction we sent with en-opportunity-source.png:
Use the attached synthetic, unbranded bottle image for a blog tutorial demonstration. First make exactly ONE edited image: change only the far-left background strip to muted sage green; keep the bottle, cap, position and remaining background as close to the input as possible. Use an available image-editing model, preferably GPT Image if supported. Do not generate a new bottle from scratch. Return the actual image with a download link, identify the model used if the tool reports it, and state any limitation about pixel-perfect preservation. Do not generate videos or additional images. Reply in English.
For your own task, replace “far-left background strip” with a precise region and describe its boundaries. Our instruction did not specify a width; Agent described its interpretation as approximately the leftmost 10%. Do not assume a vague phrase selects the exact area you intended.
2. Send, wait for an image, then inspect it
Press Send. Wait for the image tool’s completion card and an actual image preview; a text explanation alone is not an edited image. Check the model shown by the image tool if a specific model matters to your task.

This is the downloaded Agent output from October 13. It visibly adds a sage strip while retaining a recognizable bottle and cap. We have not established exact preservation of the remaining pixels, and this unlabeled synthetic bottle does not test real logos or packaging text.
Open the preview and compare it with the original at the same display size. Check the requested region, silhouette, cap proportions, label spelling, edges and shadows. For an exact-pixel requirement, use a numerical comparison such as the API section below; visual similarity is insufficient.
3. Download an accepted result, or correct only the failed part
Open the result file and use its Download control, then verify that the saved image opens. Agent also exposes Save to works; the interface we checked said conversation files are retained for seven days, so download needed files promptly. Button wording can vary with interface language.
If the product drifts, return to the original attachment and specify what changed incorrectly. For example: “Use the original bottle image again. Keep its cap height and shoulder shape; only change the background at the far left. Generate one replacement.” This is a suggested retry instruction, not a separately tested result. If a task is still running, check its status before submitting again; a timeout or absent preview does not prove that no generation occurred.
For backgrounds spanning several finished images, continue with the three-scene product workflow. If exact coordinates, transparent masks or repeatable request parameters are required, use the developer workflow below. We did not verify a mask-painting control in Agent and do not equate a natural-language region with an uploaded API mask.
Developer reference: the original GPT Image 2.5 Flare mask experiment
The following inputs, outputs and pixel measurements belong to the earlier API experiment. They remain useful for understanding mask limitations; they are not results from the Agent run above.
A mask tells an image-editing request where you want a change, but you should still inspect the rest of the returned image. In our GPT Image 2.5 Flare test, a masked background edit looked close to the original outside the target strip, yet pixel comparison found differences there. The output was not a lossless patch.
This tutorial shows the original, mask convention, actual returned images and a simple pixel check. It is for developers and creators who need to change part of a product image without silently accepting changes to the product. It does not claim that every masked edit behaves the same way or that a single example measures overall model quality.
Define the area before making the request
We reused an Ofox-generated reference from September 13: an unbranded amber bottle with an ivory cap. It is a synthetic product image, not a photograph of a customer’s product. The source is a 1024 × 1024 PNG. There is no label text, so this test says nothing about preserving logos, ingredients or regulatory copy.

Our target area is deliberately simple: the leftmost 256 columns, from x = 0 through x = 255. The bottle sits outside that strip. We request a muted sage background only inside the strip, keeping the bottle, cap, position and other areas unchanged.
The mask is an RGBA PNG of the same dimensions. Alpha is zero in the editable strip and fully opaque elsewhere. A grayscale image that merely looks black and white is not equivalent to this alpha mask. OpenAI’s image-edit reference documents transparent mask regions and the relationship between the mask and the input image; always check the endpoint’s current file constraints.
Validate the mask locally
Before uploading, inspect the file mode, dimensions and alpha distribution. This code validates our fixture; adjust the region to your actual intended edit.
from PIL import Image
source = Image.open("source.png")
mask = Image.open("mask-left.png")
assert source.size == mask.size == (1024, 1024)
assert mask.mode == "RGBA"
alpha = mask.getchannel("A")
assert alpha.crop((0, 0, 256, 1024)).getextrema() == (0, 0)
assert alpha.crop((256, 0, 1024, 1024)).getextrema() == (255, 255)
These assertions catch a reversed or flattened alpha channel before a billable request. In a typical editor, check the actual transparency rather than relying on the mask’s preview color. Save the original and the mask separately so neither is overwritten by an output image.
If several reference images are supplied, confirm which one the endpoint applies the mask to. Keep the intended base image first and do not assume the mask is a global instruction over every reference. Our mask test supplied exactly one image.
Send the actual edit
The successful test used openai/gpt-image-2.5-flare at the Ofox /v1/images/edits endpoint. It sent size=1024x1024 and n=1, with no explicit quality setting. The response reported quality: low; that is a recorded response field, not a promise about every request’s default.
curl --silent --show-error --fail-with-body \
--connect-timeout 15 --max-time 120 \
'https://api.ofox.ai/v1/images/edits' \
-H "Authorization: Bearer $OFOX_API_KEY" \
-F 'model=openai/gpt-image-2.5-flare' \
-F 'image=@source.png;type=image/png' \
-F 'mask=@mask-left.png;type=image/png' \
-F 'size=1024x1024' -F 'n=1' \
-F 'prompt=Change only the background strip at the far left quarter to muted sage green. Keep the amber bottle, cap, its position, and every other area unchanged.' \
-o edit-response.json
Set OFOX_API_KEY securely before running. The command can incur API usage. Read the saved response before decoding: an error response has no image to decode. Our successful responses contained data[0].b64_json; decode that field as base64, save the bytes and verify that the image opens at the expected dimensions.
The downloadable kit contains the original input, mask, returned files and a bounded script that performs this operation. The general GPT Image API guide covers initial access and saving an image response.
Compare the two actual outputs
We sent the same textual edit request once without a mask and obtained a successful output. The first masked attempt timed out at the client; a later masked request succeeded. A client timeout does not prove that no generation or charge occurred, so do not exclude it from a later billing reconciliation.

The successful masked result has a visibly flat sage strip at the left. The bottle’s overall identity and position appear close to the source, but appearance alone is not proof that the protected area is unchanged.

Without a mask, the model also placed a sage strip at the left, with a more textured appearance in this sample. Both requests produced a plausible interpretation of the prompt. That does not make the two outputs interchangeable for a workflow requiring exact preservation.
We compared decoded RGB values in x = 256 through 1023, all 1024 rows. This region contains 786,432 pixels. A pixel counts as changed if any of its three channels differs, even by one level.
| Successful output | Changed pixels outside the target strip | Mean absolute channel difference, 0–255 scale |
|---|---|---|
| With mask | 784,316 of 786,432 | 3.493 |
| Without mask | 785,921 of 786,432 | 5.464 |
The masked result had a lower mean difference in this pair. The sample is too small to claim a general advantage of that magnitude. More importantly, neither result met an exact-pixel-preservation requirement. A high changed-pixel count can include very small differences; it does not mean every changed pixel is visibly damaged.
Repeat the protected-area check
Use original downloaded files, not screenshots, JPEG previews or resized thumbnails. Those transformations introduce differences unrelated to the model edit.
from PIL import Image, ImageChops, ImageStat
a = Image.open("source.png").convert("RGB")
b = Image.open("edited.png").convert("RGB")
if a.size != b.size:
raise ValueError("Output dimensions changed; inspect before comparing")
region = (256, 0, 1024, 1024)
diff = ImageChops.difference(a.crop(region), b.crop(region))
changed = sum(any(pixel) for pixel in diff.getdata())
mean_difference = sum(ImageStat.Stat(diff).mean) / 3
print(changed, mean_difference)
This measures pixel differences, not brand accuracy, perceptual quality or product geometry. Inspect the cap, silhouette, material, edges, text and shadows separately. If the product changes position, a direct pixel difference becomes a poor description of perceived similarity, but it still correctly indicates failure of a fixed-position pixel contract.
For exact preservation, a conventional compositing workflow can place only the accepted edited region over the original. Inspect the seam and lighting; a hard boundary may be unacceptable. This is a separate postprocessing step, not a claim that the model itself protected those pixels. Do not use it to conceal changes in a published model comparison.
Diagnose failures before rerunning
If the wrong side changes, inspect alpha values and coordinates first. If the whole image changes, check whether the mask was actually attached to the request, whether the route accepts that parameter, and whether the image order matches the mask’s intended source. Keep the request metadata alongside the output.
If the server rejects the file, check file format, byte size, dimensions and the current endpoint limits. Renaming a JPEG to .png does not convert it. If the request times out, check the request record before retrying; treat a repeat as another potentially billable operation.
If a result looks good at thumbnail size, review the original at full size before accepting it. For labeled products, add explicit text and logo checks; this unlabeled bottle fixture cannot certify those properties. For changing the full scene while keeping the product, see the single-versus-two-reference test.
Frequently Asked Questions
- Does a mask guarantee that all other pixels stay identical?
- Our successful masked sample did not preserve exact RGB values outside the target region. Use an explicit pixel check if exact preservation is part of your delivery contract.
- Is the masked output always better?
- This pair is insufficient to establish that. It had a lower mean protected-region difference, but both outputs still need task-specific visual acceptance.
- Can I use a black-and-white JPEG as an alpha mask?
- Not as a substitute for the transparent PNG mask used here. Inspect the alpha channel and follow the selected endpoint's documented input requirements.


