action remove_post_removebg { label: "Remove the background of an image" description: "Removes the background of a JPG/PNG image.\n\n* File size: up to 12 MB\n* Image source: File upload (binary or as base64 encoded string) or download from URL\n* Image Content: Any photo with a foreground [(e.g. people, products, animals, cars, etc.)](/supported-images)\n* Output resolutions available: Preview (up to 0.25 megapixels), Full (up to 25 megapixels)\n\nRequires either an API Key to be provided in the `X-API-Key` request header or an OAuth 2.0 access token to be provided in the `Authorization` request header.\n" provider: remove method: POST path: "/removebg" encoding: form input: { type: "object" properties: { add_shadow: { type: "boolean" description: "Whether to add an artificial shadow to the result (default: false). NOTE: Adding shadows is currently only supported for car photos. Other subjects are returned without shadow, even if set to true (this might change in the future).\n" } bg_color: { type: "string" description: "Adds a solid color background. Can be a hex color code (e.g. 81d4fa, fff) or a color name (e.g. green). For semi-transparency, 4-/8-digit hex codes are also supported (e.g. 81d4fa77). (If this parameter is present, the other bg_ parameters must be empty.)\n" } bg_image_url: { type: "string" description: "Adds a background image from a URL. The image is centered and resized to fill the canvas while preserving the aspect ratio, unless it already has the exact same dimensions as the foreground image. (If this parameter is present, the other bg_ parameters must be empty.)" } channels: { type: "string" description: "Request either the finalized image (\"rgba\", default) or an alpha mask (\"alpha\"). Note: Since remove.bg also applies RGB color corrections on edges, using only the alpha mask often leads to a lower final image quality. Therefore \"rgba\" is recommended.\n" enum: ["rgba", "alpha"] } crop: { type: "boolean" description: "Whether to crop off all empty regions (default: false). Note that cropping has no effect on the amount of charged credits.\n" } crop_margin: { type: "string" description: "Adds a margin around the cropped subject (default: 0). Can be an absolute value (e.g. \"30px\") or relative to the subject size (e.g. \"10%\"). Can be a single value (all sides), two values (top/bottom and left/right) or four values (top, right, bottom, left). This parameter only has an effect when \"crop=true\". The maximum margin that can be added on each side is 50% of the subject dimensions or 500 pixels.\n" } format: { type: "string" description: "Result image format:\n\"auto\" = Use PNG format if transparent regions exist, otherwise use JPG format (default),\n\"png\" = PNG format with alpha transparency,\n\"jpg\" = JPG format, no transparency,\n\"zip\" = ZIP format, contains color image and alpha matte image, supports transparency (recommended).\n" enum: ["auto", "png", "jpg", "zip"] } image_file_b64: { type: "string" description: "Source image file (base64-encoded string). (If this parameter is present, the other image source parameters must be empty.)" } image_url: { type: "string" description: "Source image URL. (If this parameter is present, the other image source parameters must be empty.)" } position: { type: "string" description: "Positions the subject within the image canvas. Can be \"original\" (default unless \"scale\" is given), \"center\" (default when \"scale\" is given) or a value from \"0%\" to \"100%\" (both horizontal and vertical) or two values (horizontal, vertical).\n" } roi: { type: "string" description: "Region of interest: Only contents of this rectangular region can be detected as foreground. Everything outside is considered background and will be removed. The rectangle is defined as two x/y coordinates in the format \"x1 y1 x2 y2\". The coordinates can be in absolute pixels (suffix 'px') or relative to the width/height of the image (suffix '%'). By default, the whole image is the region of interest (\"0% 0% 100% 100%\").\n" } scale: { type: "string" description: "Scales the subject relative to the total image size. Can be any value from \"10%\" to \"100%\", or \"original\" (default). Scaling the subject implies \"position=center\" (unless specified otherwise).\n" } semitransparency: { type: "boolean" description: "Whether to have semi-transparent regions in the result (default: true). NOTE: Semitransparency is currently only supported for car windows (this might change in the future). Other objects are returned without semitransparency, even if set to true.\n" } size: { type: "string" description: "Maximum output image resolution:\n\"preview\" (default) = Resize image to 0.25 megapixels (e.g. 625×400 pixels) – 0.25 credits per image,\n\"full\" = Use original image resolution, up to 25 megapixels (e.g. 6250x4000) with formats ZIP or JPG, or up to 10 megapixels (e.g. 4000x2500) with PNG – 1 credit per image),\n\"auto\" = Use highest available resolution (based on image size and available credits).\n\nFor backwards-compatibility this parameter also accepts the values \"medium\" (up to 1.5 megapixels) and \"hd\" (up to 4 megapixels) for 1 credit per image. The value \"full\" is also available under the name \"4k\" and the value \"preview\" is aliased as \"small\" and \"regular\".\n" enum: ["preview", "full", "auto"] } type: { type: "string" description: "Foreground type:\n\"auto\" = Automatically detect kind of foreground,\n\"person\" = Use person(s) as foreground,\n\"product\" = Use product(s) as foreground.\n\"car\" = Use car as foreground,\n" enum: ["auto", "person", "product", "car"] } type_level: { type: "string" description: "Classification level of the detected foreground type:\n\"none\" = No classification (X-Type Header won't bet set on the response)\n\"1\" = Use coarse classification classes: [person, product, animal, car, other]\n\"2\" = Use more specific classification classes: [person, product, animal, car, car_interior, car_part, transportation, graphics, other]\n\"latest\" = Always use the latest classification classes available\n" enum: ["none", 1, 2, "latest"] } } } output: { type: "object" properties: { data: { type: "object" properties: { foreground_height: { type: "integer" description: "Height of the foreground image. In case the input image resolution is higher than the limit (> 25 megapixels) this value is expressed with respect to the input image resolution." } foreground_left: { type: "integer" description: "Left position of the foreground image along the horizontal axis. In case the input image resolution is higher than the limit (> 25 megapixels) this value is expressed with respect to the input image resolution." } foreground_top: { type: "integer" description: "Top position of the foreground image along the vertical axis. In case the input image resolution is higher than the limit (> 25 megapixels) this value is expressed with respect to the input image resolution." } foreground_width: { type: "integer" description: "Width of the foreground image. In case the input image resolution is higher than the limit (> 25 megapixels) this value is expressed with respect to the input image resolution." } result_b64: { type: "string" description: "Base64 encoded string of result image" } } } } } }