NovaKitv1.0

Image Editing

Edit images with inpainting, outpainting, background removal, and more

Image Editing

Edit existing images with a variety of operations including inpainting, outpainting, background removal, upscaling, and more.

Try it Now

Test the Image Editing API directly in your browser:

Endpoint

POST /images/edits
POST /images/edits?async=true

Required scope: image

Use async=true for long-running operations. This returns a job ID that you can poll for completion.

Request Body

{
  "image": "https://example.com/image.png",
  "operation": "inpainting",
  "mask": "https://example.com/mask.png",
  "prompt": "A red sports car",
  "strength": 0.95,
  "model": "fal-ai/flux-kontext-lora/inpaint"
}

Common Parameters

ParameterTypeRequiredDefaultDescription
imagestringYes-Image URL or base64 data
operationstringYes-Operation type (see below)
modelstringNovariesModel to use for the operation
strengthnumberNo0.95Edit strength (0-1)
model_inputsobjectNo-Additional model-specific parameters

Operations

Inpainting

Fill a masked region with new content based on a prompt.

{
  "image": "https://example.com/photo.jpg",
  "operation": "inpainting",
  "mask": "https://example.com/mask.png",
  "prompt": "A fluffy cat sitting on the couch"
}
ParameterRequiredDescription
maskYesMask image (white = edit area, black = preserve)
promptYesWhat to generate in the masked area

Outpainting

Extend an image beyond its original boundaries.

{
  "image": "https://example.com/photo.jpg",
  "operation": "outpainting",
  "direction": "right",
  "expand_pixels": 512,
  "prompt": "Continue the forest landscape"
}
ParameterRequiredDefaultDescription
directionYes-left, right, top, bottom, or all
expand_pixelsNo256Pixels to expand
promptNo-Guidance for new content

Background Removal

Remove the background from an image, returning a PNG with transparency.

{
  "image": "https://example.com/photo.jpg",
  "operation": "backgroundRemoval"
}

No additional parameters required. Returns a PNG with transparent background.

Background Replace

Remove and replace the background with a new one.

{
  "image": "https://example.com/portrait.jpg",
  "operation": "backgroundReplace",
  "new_background": "A tropical beach at sunset"
}
ParameterRequiredDescription
new_backgroundYesDescription of new background (prompt)

Object Removal

Remove an object from the image and fill the area naturally.

{
  "image": "https://example.com/photo.jpg",
  "operation": "objectRemoval",
  "mask": "https://example.com/mask.png"
}
ParameterRequiredDescription
maskYesMask covering the object to remove

Super Resolution (Upscaling)

Increase image resolution with AI upscaling.

{
  "image": "https://example.com/small.jpg",
  "operation": "superResolution",
  "scale": 4
}
ParameterRequiredDefaultDescription
scaleNo2Scale factor: 2 or 4

Face Enhancement

Enhance and restore faces in images.

{
  "image": "https://example.com/portrait.jpg",
  "operation": "faceEnhancement"
}

Automatically detects and enhances all faces in the image.

Colorization

Colorize black and white images.

{
  "image": "https://example.com/vintage.jpg",
  "operation": "colorization"
}

Style Transfer

Apply artistic styles to images.

{
  "image": "https://example.com/photo.jpg",
  "operation": "styleTransfer",
  "prompt": "in the style of Van Gogh's Starry Night"
}
ParameterRequiredDescription
promptYesStyle description to apply

Available Models

Each operation has a default model, but you can override with any compatible model:

OperationDefault ModelNotes
inpaintingfal-ai/flux-kontext-lora/inpaintFill masked regions
outpaintingfal-ai/creative-outpaintingExtend image borders
backgroundRemovalfal-ai/bria/background/removeRemove background
superResolutionfal-ai/topaz/upscale/imageAI upscaling
faceEnhancementfal-ai/face-enhanceRestore faces
styleTransferfal-ai/z-image/turbo/image-to-imageApply styles
colorizationfal-ai/z-image/turbo/image-to-imageColorize B&W

Alternative Models

ModelUse Case
fal-ai/z-image/turbo/inpaintFast inpainting
fal-ai/flux/dev/image-to-imageHigh quality image-to-image
fal-ai/aura-srFast upscaling
fal-ai/clarity-upscalerHigh quality upscaling

Response

{
  "created": 1703123456,
  "data": [
    {
      "url": "https://fal.media/files/edited123.png",
      "width": 1024,
      "height": 1024
    }
  ],
  "model": "fal-ai/flux-kontext-lora/inpaint",
  "model_tier": "standard",
  "usage": {
    "edits_used": 1,
    "quota_multiplier": 1.25,
    "edits_remaining": 74
  }
}

Quota & Pricing

Image edits use the image_edits quota bucket:

PlanImage Edits/Month
Free-
Pro75
Business300

Model tier multipliers apply:

TierMultiplierExample Operations
Fast1xBackground removal
Standard1.25xInpainting, outpainting
Premium1.5xHigh-quality upscaling

Examples

curl -X POST https://www.novakit.ai/api/v1/images/edits \
  -H "Authorization: Bearer sk_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "image": "https://example.com/product.jpg",
    "operation": "backgroundRemoval"
  }'
import requests

response = requests.post(
    "https://www.novakit.ai/api/v1/images/edits",
    headers={
        "Authorization": "Bearer sk_your_api_key",
        "Content-Type": "application/json"
    },
    json={
        "image": "https://example.com/room.jpg",
        "operation": "inpainting",
        "mask": "https://example.com/couch-mask.png",
        "prompt": "A modern blue velvet sofa"
    }
)

print(response.json()["data"][0]["url"])
const response = await fetch(
  "https://www.novakit.ai/api/v1/images/edits",
  {
    method: "POST",
    headers: {
      "Authorization": "Bearer sk_your_api_key",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      image: "https://example.com/small-image.jpg",
      operation: "superResolution",
      scale: 4,
    }),
  }
);

const data = await response.json();
console.log(`Upscaled to: ${data.data[0].width}x${data.data[0].height}`);

Mask Format

Masks should match the input image dimensions. Use white (#FFFFFF) for areas to edit and black (#000000) for areas to preserve.

You can provide masks as:

  • URL to a PNG image
  • Base64-encoded image data

Creating Masks Programmatically

from PIL import Image, ImageDraw
import base64
import io

# Create a mask
mask = Image.new('L', (1024, 1024), 0)  # Black background
draw = ImageDraw.Draw(mask)

# Draw white region for editing (e.g., a rectangle)
draw.rectangle([200, 200, 800, 800], fill=255)

# Save or convert to base64
mask.save('mask.png')

# Or convert to base64 for API
buffer = io.BytesIO()
mask.save(buffer, format='PNG')
base64_mask = base64.b64encode(buffer.getvalue()).decode()

Async Mode

For long-running operations, use async mode:

import requests
import time

# Start async job
response = requests.post(
    "https://www.novakit.ai/api/v1/images/edits?async=true",
    headers={"Authorization": "Bearer sk_your_api_key"},
    json={
        "image": "https://example.com/photo.jpg",
        "operation": "superResolution",
        "scale": 4
    }
)

job_id = response.json()["id"]

# Poll for completion
while True:
    status = requests.get(
        f"https://www.novakit.ai/api/v1/jobs/{job_id}?poll=true",
        headers={"Authorization": "Bearer sk_your_api_key"}
    ).json()

    if status["status"] == "completed":
        print(f"Result: {status['outputData']['images'][0]['url']}")
        break
    elif status["status"] == "failed":
        print(f"Failed: {status.get('errorMessage')}")
        break

    time.sleep(3)

Error Handling

StatusErrorSolution
400image is requiredProvide image URL or base64
400Invalid operationUse a valid operation type
400mask is required for inpaintingProvide mask for inpainting/object removal
402Image edit limit exceededUpgrade plan or wait for reset
403Model tier not allowedUpgrade plan for premium operations

Supported Image Formats

Input:

  • JPEG / JPG
  • PNG
  • WebP

Output:

  • PNG (for transparency operations)
  • JPEG (for others)

On this page