LaMa

LAMA

Removes objects, text, watermarks and blemishes from a photo: paint what to remove white on a black mask, and it fills that area in to match its surroundings.

Image Editinginpaintingobject-removalwatermark-removalapache-2.0Fine-tunable
LaMa: Image Editing model on Kainguru

About LaMa

Capabilities

  • Large areas — fills big holes and long strokes, not only small spots
  • Untouched elsewhere — only the white area of the mask changes; every other pixel is the photo's own
  • Fine-tunable — train it on your own photos, masks and the results you want

Good to know

  • Photos and masks are PNG, JPEG or WebP, at most 50 MB and 16.8 megapixels, at least 16 pixels a side. The mask has the photo's size: white (or light grey) marks the area to fill.
  • Photos larger than 2048 pixels on the longer side are filled on a 2048-pixel copy; the fill is scaled back and only the masked area changes.
  • It fills with textures from the rest of the photo, so it suits removing things more than adding new ones.
  • Fine-tuning takes one ZIP (at most 4 GB, no password) with 4 to 1000 examples of a photo, its mask and the target (the photo as it should look once filled, or the photo itself), all the same size and at least 256 pixels a side, and a manifest.jsonl holding one {"input": "...", "mask": "...", "target": "..."} line each.
  • Training works on 256 x 256 crops around the masked areas and stops after the steps you ask for or after 9 hours, whichever comes first, keeping what it has learned.

LaMa inputs and output

NameTypeRequiredDefaultDetails
maskfileYes—A black-and-white picture of the photo's size: white marks the area to fill (an object, text or a watermark to remove), black what to keep.
1–2048 characters · image/png, jpeg, webp
imagefileYes—The photo: PNG, JPEG or WebP, at most 50 MB and 16.8 megapixels, at least 16 pixels a side.
1–2048 characters · image/png, jpeg, webp

Output. Returns PNG image: The photo with the masked area filled in, as a PNG of the same size.

Run LaMa with the API

Send your API key in the X-API-Key header. The run is asynchronous: submit it, then poll it until it finishes. Create an API key.

cURL
curl -X POST "https://api.kainguru.com/api/v1/executions?mlFlowId=LAMA" \
  -H "X-API-Key: kg_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
  "input": {
    "image": "https://example.com/input.png",
    "mask": "https://example.com/input.png"
  },
  "outputFormat": "json"
}'

# Poll until the execution reaches a terminal state
curl "https://api.kainguru.com/api/v1/executions/{executionId}" \
  -H "X-API-Key: kg_your_api_key"
Python
from kainguru import KainguruClient

with KainguruClient(api_key="kg_your_api_key", base_url="https://api.kainguru.com/api") as client:
    submitted = client.executions.execute(
        "LAMA",
        {
          "image": "https://example.com/input.png",
          "mask": "https://example.com/input.png"
        },
        output_format="json",
    )
    result = client.executions.await_completion(submitted.id)
    print(result.execution.output)

Fine-tune LaMa

You can fine-tune LaMa on your own data and run the tuned model through the same API. Dataset: One ZIP (at most 4 GB, no password) with 4 to 1000 examples of a photo, its mask and the target (the photo filled in, or the photo itself), the same size, and manifest.jsonl with one {"input", "mask", "target"} line each.

The steps are in the docs.

LaMa pricing

Price per image: 0.0209 credits ($0.000209). The price is shown again before every run; all prices are on the pricing page.

Licence and source

Kandinsky 2 2 Inpaint: Image Editing model on Kainguru
Image Editing

Kandinsky 2 2 Inpaint

Kandinsky 2.2 inpainting: paints the masked part of a photo from a text prompt and leaves the rest untouched.

Kandinsky 2 2 Img2img: Image Editing model on Kainguru
Image Editing

Kandinsky 2 2 Img2img

Kandinsky 2.2 restyles a photo from a text prompt and keeps its layout; the strength sets how far the result moves…

Qwen-Image-Edit-2509: Image Editing model on Kainguru
Image Editing

Qwen-Image-Edit-2509

Edit a picture from a written instruction, changing objects, people, text or style while keeping the rest consistent.

Fine-tunable
DDColor: Image Editing model on Kainguru
Image Editing

DDColor

Colourises black-and-white and faded photos: it keeps each photo's own light and shade and adds natural colours.

Fine-tunable
LDSR: Image Editing model on Kainguru
Image Editing

LDSR

Enlarges a small picture 4 times with latent diffusion, drawing in new plausible detail. A creative upscale: richer…

Fine-tunable
LongCat Image Edit: Image Editing model on Kainguru
Image Editing

LongCat Image Edit

Edits a picture from an instruction in English or Chinese with LongCat-Image-Edit (6B, Apache-2.0): local and global…

Fine-tunable