← All features

Feature · Crop and framing

LassoCut crop and framing: crop to the subject, then set margins and placement

A catalogue looks consistent when every product sits the same way in its frame. LassoCut can crop the result to the subject with the margins you choose, resize the subject inside the frame and place it, in the same call that removes the background.

What it does

FieldExampleWhat it does
croptrueCrops the result to the subject's bounding box.
crop_margin10%, 30px, 10px 20px, 5% 10% 5% 10%Margin kept around the subject when cropping: one, two or four values, in the CSS order (top, right, bottom, left). A percentage is of the subject's height for top and bottom, of its width for left and right.
scale80%, originalSize of the subject relative to the frame, from 10% to 100%.
positioncenter, original, 50% 100%Where the subject sits, as horizontal and vertical percentages; one value applies to both. With scale and no position, the subject is centred.
roi0% 0% 50% 100%Region of interest, x1 y1 x2 y2 in px or %: everything outside it is removed from the cut-out.

The steps run in this order: the background is removed, roi clears what lies outside the region, crop cuts the frame down to the subject plus its margins, then scale and position place the subject inside that frame. The response headers X-Foreground-Top, -Left, -Width and -Height give the subject's box in the returned image.

A real example

A yellow banana casting a hard shadow on a pink background, with lots of empty space around it
Before · 1200 × 742
The same banana cut out by LassoCut, cropped close with an even margin on white
After · 542 × 400

Photo by Mike Dorner, first published on Unsplash under CC0 (public domain), via Wikimedia Commons; sent at full size with crop=true, crop_margin=10% and bg_color=ffffff. The pink backdrop and the banana's shadow are gone; the frame is the banana plus 10% on each side.

How to use it

  • AI assistants: "crop these to the subject" with the MCP connector.
  • Command line: pass any of these fields with --extra-api-option (CLI guide).
  • Batch tool: it has no crop option yet; use the CLI or the API for cropped batches.

Crop close, on white

curl --fail-with-body -H "X-Api-Key: $LASSOCUT_API_KEY" \
     -F "image_file=@photo.jpg" \
     -F "size=preview" \
     -F "crop=true" \
     -F "crop_margin=10%" \
     -F "bg_color=ffffff" \
     -o cropped.jpg \
     https://api.lassocut.com/v1.0/removebg

Run against the production API on 29 September 2026 with a 1024 × 678 JPG of a watch: HTTP 200, image/jpeg, 351 × 235. The watch measured 293 × 195 and sat 29 px from the left and 20 px from the top: 10% of its width and height.

Keep the frame, place the subject

curl --fail-with-body -H "X-Api-Key: $LASSOCUT_API_KEY" \
     -F "image_file=@photo.jpg" \
     -F "size=preview" \
     -F "scale=80%" \
     -F "position=50% 100%" \
     -o framed.png \
     https://api.lassocut.com/v1.0/removebg

Run against the production API on 29 September 2026 with the same JPG: HTTP 200, image/png, 614 × 406. The watch was 325 px high, 80% of the frame, centred horizontally and resting on the bottom edge (top at 81 px).

Honest limits

  • No fixed canvas size: there is no field for a square or a set aspect ratio. The result keeps the photo's frame, or the subject's box plus margins with crop. For a 1:1 listing, pad the image afterwards or start from square photos.
  • Margins are capped at 500 px and at half the subject's size on each side.
  • crop_margin takes one, two or four values; three values return invalid_crop_margin.
  • A photo where no subject is found returns unknown_foreground and costs nothing. A roi outside the image returns roi_exceeds_bounds.
  • The bounding box follows the mask, so a stray strand of hair or a thin strap sets the edge of the crop too.
  • Edges keep a trace of the original backdrop colour: on a new background (the white one in the example above), a faint tint of the old colour can show along the outline.

Try it on your own photo

Drop an image on the home page to see the cut-out, then create an account for 50 free previews a month (up to 10 a day).

See also: marketplaces · e-commerce · backgrounds · framing fields · Node.js guide · pricing.