FLUX.1 [dev] Inpainting with LoRAs

edit

fal-ai/flux-lora/inpainting

Repaint only the masked region, LoRA applied.

Inpainting on FLUX.1 [dev]: provide an image, a mask and a prompt, and only the masked area is regenerated with your LoRAs active. Use it to drop a trained subject or style into part of an existing image without touching the rest.

Parameters

Schema facts from the fal API; the notes are ours.

Required

promptstringrequired

The text description of what to generate.

Tip: If your LoRA used a trigger word, include it. Describe the scene around the subject normally.

Raw schema description

The prompt to generate an image from.

image_urlstringrequired

Input image for image-to-image, editing or video conditioning.

Raw schema description

URL of image to use for inpainting. or img2img

mask_urlstringrequired

Mask defining which region gets repainted in inpainting.

Raw schema description

The mask to area to Inpaint in.

Optional

image_sizeobject

Output resolution, as a preset name or explicit width and height.

Raw schema description

The size of the generated image.

num_inference_stepsintegerdefault: 28150

Number of denoising steps per image. More steps, more refinement, more latency.

Tip: Defaults are tuned per model. Cutting steps in half is the quickest way to trade quality for speed.

Raw schema description

The number of inference steps to perform.

seedinteger

Random seed. Same seed plus same inputs gives a nearly identical image.

Tip: Fix the seed when comparing LoRA scales or parameters, so the only thing changing is the thing you are testing.

Raw schema description

The same seed and the same prompt given to the same version of the model will output the same image every time.

loraslistdefault: []

List of LoRA weights to load, each with a path (URL or HF repo) and a scale.

In the atelier: Which bracelets the painter wears for this painting, and how hard he leans on each.

Tip: Order does not matter; scales do. Start every LoRA at 1.0 and adjust one at a time.

Watch out: Stacking three strong LoRAs usually degrades all of them. Lower each scale when combining.

Raw schema description

The LoRAs to use for the image generation. You can use any number of LoRAs and they will be merged together to generate the final image.

guidance_scalenumberdefault: 3.5035

How strictly generation follows the prompt (classifier-free guidance).

In the atelier: How tightly you hold the painter to the brief. Too tight and the work gets stiff and oversaturated; too loose and he wanders.

Tip: Stay near the endpoint default. Adjust in steps of 0.5.

Raw schema description

The CFG (Classifier Free Guidance) scale is a measure of how close you want the model to stick to your prompt when looking for a related image to show you.

sync_modebooleandefault: false

Returns media as a data URI instead of a hosted URL, and skips storing it.

Tip: Useful for privacy; awkward for big files. Most workflows leave it off.

Raw schema description

If `True`, the media will be returned as a data URI and the output data won't be available in the request history.

num_imagesintegerdefault: 114

How many images to generate in one call.

Raw schema description

The number of images to generate. This is always set to 1 for streaming output.

enable_safety_checkerbooleandefault: true

Runs a safety filter on outputs.

Raw schema description

If set to true, the safety checker will be enabled.

output_formatenumdefault: jpegjpeg | png

File format of the result: jpeg, png or webp.

Raw schema description

The format of the generated image.

accelerationenumdefault: nonenone | regular

Speed and cost preset for the generation backend.

Tip: 'regular' balances quality and latency. Use higher acceleration for drafts and iteration.

Raw schema description

Acceleration level for image generation. 'regular' balances speed and quality.

strengthnumberdefault: 0.850.011

How far image-to-image is allowed to move from the input image (0 keeps it, 1 ignores it).

Tip: 0.6 to 0.8 keeps composition while letting the LoRA restyle.

Raw schema description

The strength to use for inpainting/image-to-image. Only used if the image_url is provided. 1.0 is completely remakes the image while 0.0 preserves the original.

Call it

import { fal } from "@fal-ai/client";

const result = await fal.subscribe("fal-ai/flux-lora/inpainting", {
  input: {
    "prompt": "turn the sketch into a finished painting",
    "image_url": "https://your-cdn.com/input.jpg",
    "mask_url": "...",
    "loras": [
      {
        "path": "https://your-cdn.com/lora.safetensors",
        "scale": 1
      }
    ]
  },
  logs: true,
});
console.log(result.data);