Magic Wand AI

Remove, add, or replace objects and generate the new fill with a prompt. If you want to remove object rather than adding new one, with Magic Wand endpoint, you can use special parameters on prompt.

Note: Also, please check out for Remove Object and Change Material parameters.

POST /v2/generate

Parameters

Name
Type
Description

model

string

Required

Value must be magicwand for Magic Wand AI. Browse other Generators.

image

string

Required

URL of the input image. Encode your image url if url have special characters.

mask_image

string

Required

URL of the mask image. Learn more about mask images. Encode your image url if url have special characters.

prompt

string

Optional

Description of desired design. You can use special parameters.

material_image

string

Optional

Material reference image to fill mask area with material. Leave empty for Prompt design or Removing objects.

remove

string

Optional Use true value to Remove selected mask item

controlnet

string

Optional Use true value for Structure-Guided Fill. It preserves mask area's painting geometry.

pid

integer

Optional

Persona ID to use if you want to use Persona Slots for images.

seed

integer

Optional

For reproducible results

enhance_prompt

string

Optional

If you want to use Prompt Enhance model, use true value. If you want to continue without Prompt Enhancer don't add enhance_prompt parameter to your requests.

format

string

Optional

Output format values: jpg, png or webp

processing_url

string

Optional

Get process results with same endpoint, alternative to /results endpoint usage.

webhook

string

Optional

Get process results with real-time webhooks, alternative to /results endpoint usage.

Curl Example

curl -X POST https://api.luw.ai/v2/generate \
  -H "Authorization: Bearer LUW_API_TOKEN" \
  -d "model=magicwand" \
  -d "mask_image=https://example.com/roommask.jpg" \
  -d "prompt=Modern minimalist living room" \
  -d "image=https://example.com/room.jpg"

Response Example

{
  "status": true,
  "progress": {
    "started_at": "2024-01-04T12:00:00Z",
    "state": "processing",
    "percent": 45
  },
  "processing": true,
  "processing_url": "abc_123..."
}

✨ Get results using the /results endpoint.

Alternative legacy method: Add &processing_url={url} to your request.

What is Mask Image?

A mask image is a black-and-white image used to define selected regions.

  • White = the selected area (object, region, or detail)

  • Black = the unselected background

Think of it as a spotlight: white reveals what matters, black hides the rest.

Mask example:

Export Mask from Luw.ai's Web Interface

You want to export mask from Luw.ai's MagicWand AI from web interface? Click here and draw your mask. Don't click "Generate with Image", rather than click "Download" button at the page's bottom. Try WebUI Mask Exporter now.

✨ Tip: Want to create masks with text prompts or get all masks?

Use Segment AI to generate smart mask images directly from your prompt — or retrieve masks for every object in your image. Check Segment AI for more details.

Special Parameters

Remove Furniture

You can execute special actions like Remove Furniture, Remove Object or remove anything selected with mask_image parameter, check Mask Image section for better results.

To switch Remove Object mode, you can simply add remove parameter with true value like this example:

?remove=true

Curl Example

curl -X POST https://api.luw.ai/v2/generate \
  -H "Authorization: Bearer LUW_API_TOKEN" \
  -d "model=magicwand" \
  -d "image=https://example.com/room.jpg" \
  -d "mask_image=https://example.com/roommask.jpg" \
  -d "remove=true"

Material Swap

You can execute special actions like Swap Materials with material_image parameter, it will change Mask Image you provided, with the material image you provided.

To switch Material Swap mode, you can simply add material_image parameter with image url like this example:

curl -X POST https://api.luw.ai/v2/generate \
  -H "Authorization: Bearer LUW_API_TOKEN" \
  -d "model=magicwand" \
  -d "image=https://example.com/room.jpg" \
  -d "mask_image=https://example.com/roommask.jpg" \
  -d "material_image=https://example.com/material.jpg"

Last updated