Car Layers (Base64)#
Flexible car photo compositing: select which layers to return (composite, cutout with optional shadow, soft shadow mask, empty backdrop) at the chosen output format and size.
Cost: 1 credit on HTTP 200.
The biggest car in the photo is cut out and placed on background_preset, in the photo's own perspective. With match_photo_light (default) the new shadow follows the car's existing shadow; with frame (default) the output is recomposed around the car at frame_aspect.
By default returns composite and cutout. Omit layers you don't need for lower latency. Pass bake_shadow=false to get the car alone in the cutout. output_format (jpeg/png/webp) applies to composite and background; cutout and shadow are always PNG. max_size resizes all outputs after compositing, keeping the frame metadata in canvas coordinates.
What each layer looks like


composite → composite_base64
cutout → img_without_background_base64
shadow → shadow_base64
background → background_base64Endpoint#
POST /v1.0/car-layers-base64
Base URL: https://api.withoutbg.com · Spec: openapi.json
Example (cURL)#
cURL
curl -X POST \
-H "X-API-Key: $WITHOUTBG_API_KEY" \
-H "Content-Type: application/json" \
-d '{"image_base64":"<raw_base64>","scene_overrides":{"albedo":[0.92,0.9,0.86],"floor_albedo_scale":0.5}}' \
"https://api.withoutbg.com/v1.0/car-layers-base64"Authentication#
Provide your API key in the request header:
API key header
X-API-Key: <your_api_key>Request#
Content-Type: application/json
Fields#
image_base64(string, required) — Input image as a raw Base64 string (nodata:URI prefix). Supported formats: JPEG, PNG, WebP, AVIF, HEIC, TIFF, BMP, GIF. Maximum decoded size: 20.0 MB. Invalid Base64, non-image data, unsupported formats, or oversize payloads fail with HTTP 422.background_preset(string, optional) · default"white-seamless"— Backdrop the car is composited onto. Rendered procedurally in the photo's recovered camera, so perspective matches. Fine-tune it withscene_overrides. Previews: https://withoutbg.com/docs/pro-model/car-layers-base64#background_preset
Infinite white sweep, almost no direction.

Neutral grey cyc with a shaped pool, the catalogue look.

Dark grey room, pool carries the separation.

White wall over a graphite grey floor.

Warm walls over a darker floor.

Near-black room with a tight pool under the car.
scene_overrides(object, optional) — Optional tweaks on top ofbackground_preset; omitted fields keep the preset's value. Unknown keys are rejected. Each field applies only to the preset families in itsx-backgroundFamilies(today every field is indoor-only); a field that doesn't apply to the chosen preset is rejected. Examples: https://withoutbg.com/docs/pro-model/car-layers-base64#scene_overrides
Preset as is 
With the overrides below scene_overrides
{ "scene_overrides": { "albedo": [ 0.92, 0.9, 0.86 ], "floor_albedo_scale": 0.5 } }scene_overrides.albedo([number, number, number], optional, 0–1) — Backdrop colour as linear RGB, each 0–1, e.g.[0.92, 0.90, 0.86]for a warm off-white.scene_overrides.floor_albedo_scale(number, optional, 0–2) — Floor brightness relative to the wall: 1 = same as wall, 0.12 = graphite floor under a white wall (asgraphite-floor).scene_overrides.bevel(number, optional, 0–1) — Wall-to-floor transition: 0 = hard corner, 1 = smooth cove.scene_overrides.pool_gain(number, optional, 0–1) — Strength of the light pool on the floor under the car: 0 = flat, 0.9 = spotlit (asdark-hero).scene_overrides.pool_radius_m(number, optional, 0.5–10) — Radius of the light pool in metres (presets use 2.2–4.5).scene_overrides.exposure(number, optional, 0.25–4) — Backdrop brightness multiplier: 1 = preset, 0.8 = darker, 1.2 = brighter.frame(boolean, optional) · defaulttrue— When true (default), reframe the output: the car fills about 60% of the frame width with headroom above and floor below, its shadow kept in frame. When false, the output keeps the photo's framing and size.frame_aspect(string, optional) · default"4:3"— Output aspect ratio (width:height) whenframeis true.originalkeeps the photo's own ratio. Ignored whenframeis false. Shapes: https://withoutbg.com/docs/pro-model/car-layers-base64#frame_aspect4:3Landscape, the marketplace listing default.
3:2Landscape, matches most DSLR photos.
16:9Wide banner or website hero.
1:1Square, for social posts and thumbnails.
photo's ratioKeep the photo's own width:height ratio.
frame_grow(boolean, optional) · defaulttrue— When true (default) and the ideal frame reaches past the photo's edge, extend the rendered backdrop instead of cropping tighter. When false, the frame stays inside the photo: it keepsframe_aspectand may trim the car's front and rear when the car fills the photo.match_photo_light(boolean, optional) · defaulttrue— When true (default), detect the car's existing shadow in the photo and fit the light direction to it, so the new shadow falls the same way. Falls back to the default light when no usable shadow is found.reconstruct_windows(boolean, optional) · defaulttrue— When true (default), run car window reconstruction: opens glass interiors while keeping the car outline. Set false to skip and use the base silhouette alpha only.outputs(array<string>, optional) · default["composite","cutout"]— Which layers to return:composite(car + shadow + backdrop),cutout(car alone, optionally with shadow),shadow(soft cast-shadow mask),background(empty backdrop). Default returns the composite and cutout. Omitted layers reduce API latency and data transfer. Examples: https://withoutbg.com/docs/pro-model/car-layers-base64#layersValues:compositecutoutshadowbackgroundbake_shadow(boolean, optional) · defaulttrue— When true (default), thecutoutincludes the camera-grounded cast shadow. When false, the cutout is the car alone (fused alpha over the original RGB).output_format(string, optional) · default"jpeg"— Image format forcompositeandbackground:jpeg(default, smaller),png(lossless), orwebp(modern).cutoutandshadoware always PNG.Values:jpegpngwebpmax_size(integer, optional, 256–8192) — Resize all output layers to fit within this longest side (pixels), 256–8192. Null (default) keeps the processed size. Resizing happens after compositing, so frame metadata stays valid.
Response#
Success Content-Type: application/json
Body fields#
input_dimensions(array<integer>, required) — Decoded input size as[width, height](pixels).processed_dimensions(array<integer>, required) — Size after server prep downscale (longest-side / megapixel caps) as[width, height]. Distinct from model inference resolution (~1024 long side).was_downscaled(boolean, required) — True when the input was downscaled during server prep.composite_base64(string, optional) — The car and its cast shadow on the rendered backdrop, as Base64 (JPEG, PNG, or WebP peroutput_format). Prependdata:image/jpeg;base64,or appropriate MIME type to display in a browser.img_without_background_base64(string, optional) — Car as Base64 PNG (RGBA). Whenbake_shadowis true, the cast shadow is baked in; when false, the car alone. Same frame ascomposite_base64. Prependdata:image/png;base64,to display in a browser.shadow_base64(string, optional) — Soft cast-shadow mask as Base64 grayscale PNG (L mode; 0 = no shadow, 255 = full shadow). Same dimensions as the output frame. Prependdata:image/png;base64,to display in a browser.background_base64(string, optional) — Empty rendered backdrop, as Base64 (JPEG, PNG, or WebP peroutput_format). Same frame and size ascomposite_base64. Prependdata:image/jpeg;base64,or appropriate MIME type to display in a browser.output_dimensions(array<integer>, required) — Size of all output layers as[width, height], after anymax_sizeresize.frame.box_xyxyandcanvas_sizeare in unresized canvas coordinates.output_format(string, required) — Echo of the requestedoutput_format.Values:jpegpngwebpframe(object, optional) — Output frame placement. Omitted whenframeis false.frame.aspect(number, required) — Output width / height.frame.box_xyxy(array<integer>, required) — Output frame as[x0, y0, x1, y1](exclusive end) on the render canvas; the canvas origin is the processed photo's top-left, shifted by any backdrop extension on the left/top.frame.canvas_size(array<integer>, required) — Render canvas as[width, height]: the processed photo's size, or larger when the backdrop was extended (grown).frame.grown(boolean, required) — True when the backdrop was extended past the photo's edges to fit the frame.background(object, required) — The backdrop the car was placed on.background.preset(string, required) — Preset that was rendered. Today the requestedbackground_preset; read it from here, not from the request. More values may be added; don't fail on one you don't know.white-seamless— Infinite white sweep, almost no direction.grey-sweep— Neutral grey cyc with a shaped pool, the catalogue look.graphite— Dark grey room, pool carries the separation.graphite-floor— White wall over a graphite grey floor.warm-showroom— Warm walls over a darker floor.dark-hero— Near-black room with a tight pool under the car.
background.family(string, required) — Scene family ofpreset. More values may be added; don't fail on one you don't know.indoor— Studio backdrop: wall, floor and cove, lit by a studio rig.
light(object, required) — Light the cast shadow was rendered with.light.azimuth_deg(number, required) — Light azimuth around the car, in degrees.light.elevation_deg(number, required) — Light elevation above the ground, in degrees.light.softness(number, required, 0–1) — How soft the light is, 0–1: 0 = hard light with crisp shadow edges (direct sun), 1 = very soft light with diffuse edges (overcast sky, large softbox).camera(object, required) — Where the photo was taken from, recovered from the photo itself.camera.elevation_deg(number, required) — Camera height as an angle seen from the car, in degrees: 0 = at ground level, 90 = straight overhead. Measured from where the car meets the ground, so a closer camera at the same height reads higher.
Errors#
| Status | Description | Detail |
|---|---|---|
401 | Invalid API Key | Invalid API Key |
402 | Insufficient credit. Please top up API credits. | Insufficient credit. Please top up API credits. |
403 | Credits Expired. Please top up API credits. If you have existing credits, they will be reactivated. | Credits Expired. Please top up API credits. If you have existing credits, they will be reactivated. |
422 | Validation error. Includes invalid Base64, non-image payloads, unsupported formats, and decoded size over 20.0 MB. | [object Object] |
429 | Rate limit exceeded (product policy: 30 requests/minute per API key). May be returned by the API gateway. Retry with exponential backoff. | {"error":"Too Many Requests","status":429,"message":"Rate limit exceeded. Please try again later"} |
500 | Internal Server Error | Internal Server Error. Please contact support: contact@withoutbg.com |
Related endpoints#
- Car Background Removal (Binary) —
POST/v1.0/car-image-without-background - Car Background (Binary) —
POST/v1.0/car-background
Contract sections are generated at build time from OpenAPI. Markdown mirror: /docs/pro-model/car-layers-base64.md