Remix API
The Remix API is an application programming interface that generates product images naturally based on a given reference image and prompt. With this API, users can seamlessly create product photos that align with their desired specifications.
Authentication
header
X-Photio-Key : {PHOTIO_API_KEY}
Do you not have an API key yet?
To call the API, you first need to obtain a Photio API key. To get your API key, go to the API Dashboard. After registering your card, you can use the issued API key.
Request Body
Variable | Type | Require | Default | Description |
---|---|---|---|---|
prompt | string | ✓ | "" | This is a description of the image you want to create, provided in English. It should include a detailed depiction of the scene or object you'd like to generate. |
product_image | string | ✓ | - | This can be either a product image in base64 format or an image URL. Areas outside the product should have an alpha value of 0 (PNG files). The AI will generate content to fill in empty areas within the product image. The output generated by the AI will match the dimensions of the input product image (e.g., input size 1024*1024 will produce output of the same size). The recommended pixel size for images is as below |
ref_image | string | ✓ | - | This can be either a ref image in base64 format or an image URL. Background image will be generated refer this image (e.g., input size 1024*1024 will produce output of the same size). The recommended pixel size for images is as below |
negative_prompt | string | "worst quality, low quality, illustration, 3d, 2d, painting, cartoons, sketch" | Enter in English any objects or scenarios you do not want to appear in the image. If nothing is entered, a default negative prompt will be used, which includes: "worst quality, low quality, illustration, 3d, 2d, painting, cartoons, sketch." | |
seed | int | -1 | This variable allows for the creation of different outcomes even with the same input. It can be set to any integer between 1 and 4,294,967,296. If you enter -1 or leave this field blank, a random seed number will be used to generate the image. | |
cfg_scale | float | 1.75 | This setting determines how closely the AI should follow the prompt. A higher cfg_scale (e.g., 2.5) means the AI will strictly adhere to the prompt and not add extraneous elements. Lower cfg_scale settings allow the AI more freedom to incorporate various elements into the image. | |
outline_fidelity | float | 1 | This parameter determines the fidelity of the product outline. When using Remix to generate backgrounds, undesirable elements may appear near the edges. By increasing this parameter value, users can remove unnecessary elements near the edges. However, setting this value too high may result in a relatively monotonous appearance in the output | |
style_fidelity | float | 0.7 | This parameter reflects the similarity to the reference image. It dictates how closely the generated image should resemble the reference image. Setting this value high may result in a creation closely resembling the reference image, but it may also generate unnecessary elements around the product. |
- Shell
- Python
- Java
- JS
curl --request POST
--url https://api.photio.io/v1/inference/remix
--header 'X-Photio-Key: {X-Photio-Key}'
--header 'Content-Type: application/json'
--data '{ "prompt": "product photograph of perfume, on the beach, perfume next to seashell", \
"product_image": "https://d2yiwnckkg6ukk.cloudfront.net/example/perfume_product.png", \
"ref_image": "https://d2yiwnckkg6ukk.cloudfront.net/example/reference_perfume_on_beach.png" }'
import requests
import json
data = {
"prompt": "product photograph of perfume, on the beach, perfume next to seashell",
"product_image": "https://d2yiwnckkg6ukk.cloudfront.net/example/perfume_product.png",
"ref_image": "https://d2yiwnckkg6ukk.cloudfront.net/example/reference_perfume_on_beach.png"
}
body_data = json.dumps(data)
# Set the necessary headers
headers = {
'X-Photio-Key': '{X-Photio-Key}',
'Content-Type': 'application/json'
}
response = requests.post('https://api.photio.io/v1/inference/remix', headers=headers, data=body_data)
class Generate {
public void remix() {
URL url = new URL("https://api.photio.io/v1/inference/remix");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestProperty("X-Photio-Key", "${PHOTIO_API_KEY}");
conn.setRequestProperty("Content-Type", "application/json");
conn.setDoOutput(true);
conn.setDoInput(true);
conn.setRequestMethod("POST");
JSONObject data = new JSONObject();
data.put("prompt", "product photograph of perfume, on the beach, perfume next to seashell");
data.put("product_image", "https://d2yiwnckkg6ukk.cloudfront.net/example/perfume_product.png");
data.put("ref_image", "https://d2yiwnckkg6ukk.cloudfront.net/example/reference_perfume_on_beach.png");
String bodyData = data.toString();
try (OutputStream os = conn.getOutputStream()) {
byte[] input = bodyData.getBytes("utf-8");
os.write(input, 0, input.length);
}
int responseCode = conn.getResponseCode();
System.out.println("Response Code : " + responseCode);
conn.disconnect();
}
}
const data = {
prompt: "product photograph of perfume, on the beach, perfume next to seashell",
product_image: "https://d2yiwnckkg6ukk.cloudfront.net/example/perfume_product.png",
ref_image: "https://d2yiwnckkg6ukk.cloudfront.net/example/reference_perfume_on_beach.png"
};
const bodyData = JSON.stringify(data);
// Set the necessary headers
const headers = {
'X-Photio-Key': '{X-Photio-Key}',
'Content-Type': 'application/json'
};
fetch('https://api.photio.io/v1/inference/remix', {
method: 'POST',
headers: headers,
body: bodyData
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
Recommended image pixel size
Tag | Ratio | Pixel size |
---|---|---|
Fullscreen | 4:3 | 1152x896 |
Widescreen | 16:9 | 1344x768 |
Ultrawide | 21:9 | 1536x640 |
Mobile landscape | 3:2 | 1216x832 |
Square | 1:1 | 1024x1024 |
Mobile Portrait | 2:3 | 832x1216 |
Tall | 9:16 | 768x1344 |
Response
Variable | Type | Description |
---|---|---|
status_code | int | In the response, you can find a status value to check the status of the request. A normal response is indicated by 200, authentication issues by 401, and API status problems by a 500 error. |
body | string | The result image data is output as a Base64-encoded string. |
Response Example
{
"status_code": Int,
"body": Base64 String
}
Output Example