Understand the decision before generating
Replacing a person's appearance can affect fabric texture, body shape, hands and nearby background. A well-written wardrobe instruction narrows the request but does not establish deterministic local editing.
What to do next
- 01
Inspect the relevant input or record
Define the exact garment change and the details that must remain factual, including seams, logos, product shape and color. Decide whether approximate interpretation is acceptable.
- 02
Apply the specific correction
Inspect the selected tool's real controls. Do not assume AISwapLab exposes garment masks, blend modes or a strict keep-everything-else pixel lock.
- 03
Verify the actual outcome
Review the output against product references and the original scene. If a controlled retouch is required, perform it in an appropriate editor rather than repeatedly regenerating the whole character.
A concrete example
Illustrative decision: changing a fictional presenter's general outfit may fit generative editing; altering one uniform badge while preserving every seam is a precision-retouching brief.
Compare decoded pixels outside a declared external edit region
For a literal unchanged-pixels requirement, qualify the external editor with a controlled lossless comparison. Agree the allowed region before editing, including any permitted feathered boundary; do not enlarge it afterward to hide an unexpected change. Keep the same canvas, orientation, channel mode and colour interpretation. A whole-image resize or colour conversion makes this exact comparison a different task, even when the picture looks similar.
The optional local script below checks matching 8-bit RGBA PNG files and a binary L-mode mask: white permits changes, black requires equality. It compares all four decoded channels outside the mask, including alpha. A nonzero difference fails that pixel condition; zero only establishes the stated sample equality. It does not prove that the changed garment is factually correct, that the mask was authorized, or that file metadata is identical. AISwapLab does not expose this as a garment-region lock.
Local synthetic verification used Python 3.12.10 and Pillow 12.2.0: a change inside an allowed pixel passed the outside check, while a one-unit alpha change outside it failed. These generated 8-by-8 arrays test the comparison logic, not model quality or a real garment edit. Review the actual permitted edit and product details separately.
from PIL import Image, ImageChops
before = Image.open("approved-source.png")
after = Image.open("edited-export.png")
allowed = Image.open("allowed-region.png")
assert before.format == after.format == "PNG"
assert before.mode == after.mode == "RGBA"
assert before.size == after.size == allowed.size
assert allowed.mode == "L"
assert set(allowed.getdata()).issubset({0, 255})
assert before.info.get("icc_profile") == after.info.get("icc_profile")
assert before.getexif().get(274, 1) == after.getexif().get(274, 1) == 1
outside = ImageChops.invert(allowed)
delta = ImageChops.difference(before, after)
changed = any(ImageChops.multiply(band, outside).getbbox() is not None
for band in delta.split())
print("outside pixels changed" if changed else "outside pixels equal")Before you call it ready
- Define the exact garment change and the details that must remain factual, including seams, logos, product shape and color.
- Inspect the selected tool's real controls.
- Review the output against product references and the original scene.
When to stop or choose another method
Do not use an approximate generated garment as evidence of an actual product's construction or exact appearance. Confirm required product and brand details independently.
