Object
Learn how to control the positioning of your product images.
Last updated
Learn how to control the positioning of your product images.
Last updated
AI Background API supports several options to provide source images that need to be processed.
URL of the input image should be from 1 to 4096 characters. The image must be accessible by our system.
You can connect 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.
The API supports the following image formats as inputs: BMP, GIF, JPEG, PNG, TIFF, WEBP, AVIF, and HEIC.
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"
"original"
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.
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.
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
.
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:
left top corner:
"x":
0.0
, "y":
0.0
top edge:
"x":
0.5
, "y":
0.0
right top corner:
"x":
1.0
, "y":
0.0
left edge:
"x":
0.0
, "y":
0.5
center:
"x":
0.5
, "y":
0.5
right edge:
"x":
1.0
, "y":
0.5
left bottom corner:
"x":
0.0
, "y":
1.0
bottom edge:
"x":
0.5
, "y":
1.0
right bottom corner:
"x":
1.0
, "y":
1.0
image_url
str
1 - 4096
is required
rotation_degree
float
0.0 - 360.0
0.0
scale
float
0.0 - 1.0
1.0
position.x
float
0.0 - 1.0
0.5
position.y
float
0.0 - 1.0
0.5
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.
type allows to manually define a product position based on dependent parameters such as position
, scale
, and rotation_degree
. It is used by default.
type keeps the product's position on the generated images the same as it was on the input images.