SDK Reference
Remove Background
Remove image backgrounds using the MakePhotos SDK.
Remove Background
Remove the background from images using Cloudinary's AI-powered background removal.
Usage
const result = await client.removeBg.create({
imageUrl: 'https://res.cloudinary.com/.../product.jpg',
});
console.log(result.resultUrl);Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
imageUrl | string | Yes | Cloudinary URL of the input image |
The input image must be hosted on Cloudinary (res.cloudinary.com). If your image is elsewhere, upload it first.
Response
interface RemoveBgResult {
resultUrl: string; // URL with background removed
creditsUsed: number; // Always 10 credits
creditsRemaining: {
monthly: number;
topup: number;
total: number;
};
}Credit cost
Background removal costs 10 credits per image, regardless of resolution.
Example workflow
Upload an image, remove the background, then generate a studio shot:
const uploaded = await client.upload.create({
file: fs.readFileSync('./raw-product.jpg'),
filename: 'raw-product.jpg',
});
const noBg = await client.removeBg.create({
imageUrl: uploaded.imageUrl,
});
const result = await client.generate.create({
imageUrl: noBg.resultUrl,
type: 'product',
style: 'studio',
});