Skip to main content
Inpainting regenerates the part of an image that a mask marks and keeps the rest unchanged. Use it to fix a detail, swap an object, or change one area without starting over.

$0.04 / $0.08

per image, raster / vector

Image + mask → image

up to 10 MB, 16 MP

POST /v1/images/inpaint

endpoint

Try it

Get an API token on your profile page (it needs a positive API units balance) and set it once per terminal session:
Then run. The request swaps the motorcycle in a public sample illustration for a bicycle. The public sample mask is white over the motorcycle and rider:

Response

  • data has one entry per image (n). Download each image from its url. With recraftv3_vector, each url points to an SVG file.
  • Image URLs are temporary: files are kept for about 24 hours, so download them. See Limits and sizes.
  • credits is the number of API units charged for the request.

Parameters

The mask is a grayscale image (PNG, JPG, or WEBP) of exactly the same size as the image. Pure white pixels (255) are regenerated and pure black pixels (0) stay unchanged. Every pixel must be one of the two. The input image must be PNG, JPG, WEBP, or SVG, under 10 MB, up to 16 MP, with sides between 256 and 4096 px. See Input images.

Examples

Set n to get up to 6 results from one request. data then has one entry per image, and the price is per image.
recraftv3_vector returns SVG instead of a raster image. It costs $0.08 per image.

Outpainting

Extend an image beyond its borders.

Erase region

Remove an area without writing a prompt.

Recraft V3

The model line behind inpainting.

Pricing

Prices of every model and tool.