Object

Learn how to control the positioning of your product images.

Product image

AI Background API supports several options to provide source images that need to be processed.

You have to upload only images without background, so you can use Claid API Background Removal.

If you choose to upload an image with a background, the scene will be created around the entire image.

HTTP(S) URL

URL of the input image should be from 1 to 4096 characters. The image must be accessible by our system.

{
    "object": {
        "image_url": "https://images.claid.ai/photoshoot-templates/docs/product.png"
    }
}

Connected storage

You can connect Cloud Storage and use it as a source for images. Currently, our API supports AWS S3 and Google Cloud Storage.

After connecting your Cloud Storage, you can refer the storage name as an input.

{
    "object": {
        "image_url": "storage://storage-name/path/image.png"
    }
}

Input image file types

The API supports the following image formats as inputs: BMP, GIF, JPEG, PNG, TIFF, WEBP, AVIF, and HEIC.

JPEG does not support background transparency, so you will probably want to select another image format.

Placement

There are several placement types that can be used to position an object in a scene. Some of them allow additional parameters for a more accurate positioning.

Absolute placement

Absolute placement is a method to manually tune an object position using one or multiple dependent fields: Position, Scale, and Rotation degree. It is used by default so that placement_type field can be omitted or specified explicitly.

{
    "object": {
        "image_url": "storage://storage-name/path/image.png",
        "placement_type": "absolute",
        "position": {
            "x":0.6, 
            "y":0.4
        },
        "scale": 0.4,
        "rotation_degree": 90.0
    }
}

Rotation degree

You can do 360-degree rotation of the object by specifying the rotation_degree option.

The object will rotate in a clockwise direction from 0 to 360 degrees.

{
    "object": {
        "image_url": "storage://storage-name/path/image.png",
        "rotation_degree": 90.0
    }
}

Scale

You can change the size of the object in relation to the background by specifying the scale option.

By default, the object is scaled to the edges of the generated background, which is equivalent to setting scale to 1.0.

If you wish, the object can be scaled down to 10% of the total width and height of the generated background, which is equivalent to setting scale to 0.1.

{
    "object": {
        "image_url": "storage://storage-name/path/image.png",
        "scale": 0.4
    }
}

Position

You can move the object around the image by specifying relative object position with position option.

By default, the object is positioned at the center of the image, which corresponds to {"x":0.5, "y":0.5}.

Positioning is not an intuitive concept, so below is a reference table for positioning the object:

{
    "object": {
        "image_url": "storage://storage-name/path/image.png",
        "position": {
            "x":0.6, 
            "y":0.4
        }
    }
}

Possible values

Original placement

Original placement is a choice when a product on the original image with a transparent background is already has a desired position. Meaning, background will be generated, while the product will remain in the same place as it was on the original image.

This placement type doesn't require any additional fields.

{
    "object": {
        "image_url": "storage://storage-name/path/image.png",
        "placement_type": "original"
    }
}

Last updated