"매 Vary Region 의 핵심 = 'mask 의 selective regeneration with prompt 의 re-injection'.". 매 2023 Midjourney 의 introduction 의 since 매 industry standard 의 region-aware editing 의 became. 2026 era 매 FLUX.1 Fill / SDXL Inpainting / Adobe Firefly Generative Fill 의 mainstream — 매 entire image 의 regenerate 의 X 의 specific area 만 의 modify.
매 핵심
매 동작 원리
Mask: 매 binary image (white = edit, black = preserve) 의 user-drawn or auto-segmented.
Latent blending: 매 unmasked region 의 original latent 의 preserve, masked region 만 의 noise → denoise.
Prompt re-injection: 매 new prompt 의 masked area 의 conditioning 의 only.
Boundary blending: 매 mask edge 의 soft blur 의 seamless transition.
매 Use cases
Object removal: unwanted person / watermark / logo 의 remove.
Object addition: empty desk 의 coffee cup 의 add.
Object replacement: red car → blue car.
Detail enhancement: face / hand 의 specific 의 refinement.
Outpainting: 매 canvas 의 expand 의 logical extension.
매 Variants
Vary Region (Subtle): 매 minor change — color / texture.
Vary Region (Strong): 매 major regeneration — different object.
Remix mode: 매 prompt 의 swap 의 enable.
💻 패턴
Pattern 1: Midjourney 의 Vary Region workflow
1. /imagine prompt: cozy living room, modern minimalist
2. Upscale → click "Vary (Region)"
3. Draw mask over old TV
4. Edit prompt: "large bookshelf with plants"
5. Submit → MJ regenerates only masked area
Pattern 2: SDXL inpainting (diffusers)
fromdiffusersimportStableDiffusionXLInpaintPipelinefromPILimportImageimporttorchpipe=StableDiffusionXLInpaintPipeline.from_pretrained("diffusers/stable-diffusion-xl-1.0-inpainting-0.1",torch_dtype=torch.float16,).to("cuda")init_image=Image.open("room.png").convert("RGB")mask_image=Image.open("mask.png").convert("RGB")# white = inpaintresult=pipe(prompt="large oak bookshelf filled with leather books and potted plants",image=init_image,mask_image=mask_image,strength=0.95,guidance_scale=8.0,num_inference_steps=40,).images[0]result.save("inpainted.png")
Pattern 3: FLUX.1 Fill (2026 SOTA)
importreplicateoutput=replicate.run("black-forest-labs/flux-fill-pro",input={"image":open("room.png","rb"),"mask":open("mask.png","rb"),"prompt":"vintage typewriter on wooden desk","guidance_scale":30,# FLUX uses higher guidance"num_inference_steps":50,},)
Pattern 4: Auto-mask via SAM 2 (Segment Anything)
fromsegment_anything_2importSAM2ImagePredictorimportnumpyasnppredictor=SAM2ImagePredictor.from_pretrained("facebook/sam2-hiera-large")predictor.set_image(image)# Click point on object to removepoint_coords=np.array([[450,300]])point_labels=np.array([1])masks,scores,_=predictor.predict(point_coords=point_coords,point_labels=point_labels,multimask_output=True,)best_mask=masks[scores.argmax()]
Pattern 5: Outpainting (canvas expansion)
fromPILimportImage# Expand canvas to rightoriginal=Image.open("portrait.png")# 512x512expanded=Image.new("RGB",(1024,512),(0,0,0))expanded.paste(original,(0,0))# Mask: black on left half (preserve), white on right half (generate)mask=Image.new("L",(1024,512),0)forxinrange(512,1024):foryinrange(512):mask.putpixel((x,y),255)result=pipe(prompt="continuation of mountain landscape, same lighting and style",image=expanded,mask_image=mask,strength=1.0,).images[0]
fromdiffusersimportStableDiffusionXLControlNetInpaintPipeline,ControlNetModelcontrolnet=ControlNetModel.from_pretrained("destitech/controlnet-inpaint-dreamer-sdxl")pipe=StableDiffusionXLControlNetInpaintPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0",controlnet=controlnet,)# Preserves edges / depth while regeneratingresult=pipe(prompt="red sports car, same angle and lighting",image=original,mask_image=mask,control_image=canny_edge_map,).images[0]
Pattern 7: Adobe Firefly Generative Fill (Photoshop API)
constresponse=awaitfetch('https://firefly-api.adobe.io/v3/images/generative-fill',{method:'POST',headers:{Authorization:`Bearer ${token}`},body:JSON.stringify({image:{source:{url:imageUrl}},mask:{source:{url:maskUrl}},prompt:'a vase of fresh tulips',}),});
매 결정 기준
상황
Approach
Casual / no-code
Midjourney Vary Region
Photoshop integrated
Adobe Firefly Generative Fill
API / batch
FLUX.1 Fill Pro (Replicate)
Local / private
SDXL Inpainting + diffusers
Auto-mask
SAM 2 + inpainting pipe
Preserve structure
ControlNet Inpaint variant
기본값: FLUX.1 Fill Pro (quality) 또는 SDXL Inpainting (local/free).
언제: mask region 의 prompt 의 generation / what-to-remove decision / multi-region edit planning.
언제 X: 매 mask itself 의 drawing — 매 visual / spatial task 의 LLM 의 weak.
❌ 안티패턴
Mask too tight: 매 boundary artifact — 매 8-16px feather 의 add.
Strength=1.0 with same prompt: 매 unnecessary regeneration. strength=0.7-0.95 의 prefer.
Ignoring lighting consistency: 매 inpainted region 의 lighting 의 mismatch — 매 prompt 의 explicit "same lighting" 의 add.
No reference to surroundings: prompt 의 isolated description — 매 context 의 mention ("matching the wooden desk").
🧪 검증 / 중복
Verified: Midjourney docs (2026), Black Forest Labs FLUX Fill paper, diffusers documentation.
신뢰도 A.
🕓 Changelog
날짜
변경
2026-05-08
Phase 1
2026-05-10
Manual cleanup — full inpainting / Vary Region guide