DEV Community

Voor AI
Voor AI

Posted on

How to Edit Text in an Image With AI Without Redesigning It

The safe way to edit text in a flat image is to define a small patch contract: exact old string, exact new string, one target region, and an explicit list of pixels that must remain semantically unchanged.

A scene-text diff showing exact old and new strings plus protected layout, light, and copy.

Input contract

source:
  permission: owned_or_authorized
  type: poster
patch:
  region: large_top_headline
  old_text: "OPEN LATE"
  new_text: "OPEN DAILY"
preserve:
  - illustration
  - people
  - border
  - background
  - crop
  - all_other_text
  - print_texture
acceptance:
  exact_new_string: true
  old_string_absent: true
  unrelated_copy_unchanged: true
Enter fullscreen mode Exit fullscreen mode

Use a source large enough to read at 100% zoom. If the text is tiny, curved around an object, heavily occluded, or repeated several times, split the task into separate patches.

Current workspace contract

Open the exact scene-text editor. On July 29, 2026 it showed GPT Image 2, a Poster headline preset, a prefilled exact-replacement prompt, required image URLs, optional mask input, Image Size Auto, Public visibility, and a 6-credit estimate. Required uploads lead through sign-in. The number can change after you supply the source, mask, size, or other settings, so use the final live estimate.

Current Voor AI text-edit form with replacement preset, prefilled prompt, image and mask inputs, size, visibility, credits, and Generate.

Step 1: quote both strings

Do not write “change the headline.” Quote the source and replacement literally:

Edit only the large top headline. Replace the exact visible text "OPEN LATE" with "OPEN DAILY".
Enter fullscreen mode Exit fullscreen mode

Quotes turn an aesthetic request into a testable assertion.

Step 2: protect the rest of the image

Add the rendering contract:

Match the existing type style, weight, color, alignment, spacing, print texture, and perspective. Preserve the illustration, people, border, background, crop, and every other word. Do not redesign the poster or add text.
Enter fullscreen mode Exit fullscreen mode

If the editor exposes a mask after upload, paint only the target line plus a small context margin. A mask that covers half the poster silently expands the model's permission to redraw it.

Step 3: run a regression check

OCR can catch string failures, but it cannot prove visual fidelity. Combine machine and manual checks:

export function validateTextPatch({ ocrBefore, ocrAfter, oldText, newText }) {
  const normalize = (s) => s.toUpperCase().replace(/\s+/g, " ").trim();
  const before = normalize(ocrBefore);
  const after = normalize(ocrAfter);
  return {
    sourceFound: before.includes(normalize(oldText)),
    replacementFound: after.includes(normalize(newText)),
    oldTextRemoved: !after.includes(normalize(oldText)),
  };
}
Enter fullscreen mode Exit fullscreen mode

Then compare at 100%:

  • baseline and alignment;
  • letter spacing and capitalization;
  • perspective and surface texture;
  • faces, products, logos, borders, and every unrelated word.

Troubleshooting

The whole poster changes. Tighten the mask and repeat “edit only.” Remove stylistic adjectives unrelated to the replacement.

The spelling is almost right. Shorten the replacement, keep exact quotes, and generate one patch at a time. For compliance-critical copy, rebuild the line in a normal design tool instead of trusting a raster render.

Other text mutates. Name every protected region and run a visual diff. If several lines changed, reject the output even when the target headline is correct.

The type looks pasted on. Ask for matching perspective, local contrast, grain, shadow, and print texture—not merely the same font.

Limitations

The result is a raster image, not recovered editable type. AI cannot reliably identify an exact font, preserve brand artwork, or guarantee legal accuracy. Never change invoices, IDs, certificates, evidence, safety labels, or someone else's copyrighted design to mislead. Model availability, credits, size options, and Public visibility may change.

When the patch contract is narrow and reviewable, replace the exact string and run the regression checklist.

Top comments (0)