replace_background
Replace the background of an image using AI by providing a prompt, specifying styles, and generating raster or vector outputs. Ideal for refining images with precise visual directions.
Instructions
Generate an image using Recraft AI from an input image with its detected background replaced based on the prompt. You can specify the input image, style, model, and number of images to generate. You should provide the same style/substyle/styleID settings as were used for input image generation (if exists) if there are no specific requirements to change the style. Other parameters are recommended to keep default if you don't have any specific requirements on them. You can use styles to refine the image background generation, and also to generate raster or vector images. Local paths or URLs to generated images and their previews will be returned in the response.
Input Schema
Name | Required | Description | Default |
---|---|---|---|
imageURI | Yes | Image to use as an input. This can be a URL (starting with http:// or https://) or an absolute file path (starting with file://). | |
numberOfImages | No | Number of images to generate. Should be from 1 to 6. Default is 1. | |
prompt | Yes | Text prompt of the background areas that will be changed. Its length should be from 1 to 1024 characters. | |
style | No | Visual style to apply. Default is realistic_image. Use this parameter only if you want to refine the image generation. Mutually exclusive with styleID, you can't specify both of them. realistic_image, digital_illustration, vector_illustration are available in both models, but icon is available only for recraftv2, and logo_raster is available only for recraftv3. If you will provide a style that is not available for the specified model, generation will fail. Styles use-cases: - realistic_image: for realistic images, photos, portraits, landscapes, etc. Raster is generated. - digital_illustration: for digital illustrations, concept art, fantasy art, etc. Raster is generated. - vector_illustration: for vector illustrations, logos, icons, etc. Vector is generated. - icon: for icons, small graphics (only in recraftv2). Vector is generated - logo_raster: for graphic design, raster logos, posters, emblems, and badges (only in recraftv3). Raster is generated. You should provide the same style/substyle/styleID settings as were used for input image generation (if they exist) if there are no specific requirements to change the style in the resulting image. | |
styleID | No | ID of the style to apply. Mutually exclusive with style, you can't specify both of them. This ID can be the style ID from recraft.ai or some previously created custom style. You should provide the same style/substyle/styleID settings as were used for input image generation (if they exist) if there are no specific requirements to change the style in the resulting image. | |
substyle | No | Visual substyle to apply. Can be specified only with style to refine more specifically. If this parameter is not specified, model will decide on the final style. Use this parameter only if you want to refine the image generation more. No need to specify if you don't have any specific requirements. Note that each combination of model and style has their own list of available substyles: - recraftv3 with style realistic_image: b_and_w, enterprise, evening_light, faded_nostalgia, forest_life, hard_flash, hdr, motion_blur, mystic_naturalism, natural_light, natural_tones, organic_calm, real_life_glow, retro_realism, retro_snapshot, studio_portrait, urban_drama, village_realism, warm_folk - recraftv2 with style realistic_image: b_and_w, enterprise, hard_flash, hdr, motion_blur, natural_light, studio_portrait - recraftv3 with style digital_illustration: 2d_art_poster, 2d_art_poster_2, antiquarian, bold_fantasy, child_book, cover, crosshatch, digital_engraving, engraving_color, expressionism, freehand_details, grain, grain_20, graphic_intensity, hand_drawn, hand_drawn_outline, handmade_3d, hard_comics, infantile_sketch, long_shadow, modern_folk, multicolor, neon_calm, noir, nostalgic_pastel, outline_details, pastel_gradient, pastel_sketch, pixel_art, plastic, pop_art, pop_renaissance, seamless, street_art, tablet_sketch, urban_glow, urban_sketching, young_adult_book, young_adult_book_2 - recraftv2 with style digital_illustration: 2d_art_poster, 2d_art_poster_2, 3d, 80s, engraving_color, glow, grain, hand_drawn, hand_drawn_outline, handmade_3d, infantile_sketch, kawaii, pixel_art, plastic, psychedelic, seamless, voxel, watercolor - recraftv3 with style vector_illustration: bold_stroke, chemistry, colored_stencil, cosmics, cutout, depressive, editorial, emotional_flat, engraving, line_art, line_circuit, linocut, marker_outline, mosaic, naivector, roundish_flat, seamless, segmented_colors, sharp_contrast, thin, vector_photo, vivid_shapes - recraftv2 with style vector_illustration: cartoon, doodle_line_art, engraving, flat_2, kawaii, line_art, line_circuit, linocut, seamless - recraftv2 with style icon: broken_line, colored_outline, colored_shapes, colored_shapes_gradient, doodle_fill, doodle_offset_fill, offset_fill, outline, outline_gradient, pictogram - recraftv3 with style logo_raster: emblem_graffiti, emblem_pop_art, emblem_punk, emblem_stamp, emblem_vintage If you will provide a substyle that is not available for the specified model and style, generation will fail. You should provide the same style/substyle/styleID settings as were used for input image generation (if they exist) if there are no specific requirements to change the style in the resulting image. |