Colors not working on image to image external api
G
Garnet Finch
I have found an issue with the images/imageToImage endpoint.
It does not appear to take into account controls when they are passed in and therefore my colors are not being applied.
We have followed the documentation here - https://www.recraft.ai/docs#generate-image
If we add the formData controls argument and then add the colors list the colors are not being applied.
We have also tried the txt2Img endpoint and this applies colors fine but this takes in json input not formData.
This is an example we have tried in NodeJS to attach colors using the img2img endpoint:
formData.append('controls', JSON.stringify({
colors: [
...(inputColors?.map(color => ({
rgb: [color.r, color.g, color.b]
})) || []),
],
no_text: noText,
}));
Log In
G
Garnet Finch
You can reproduce the issue with curl as well. We have tried the following commands:
curl -X POST "https://external.api.recraft.ai/v1/images/imageToImage" \
-H "Authorization: APIKEY" \
-F "image=@/Users/ryanbell/Downloads/test.png" \
-F "prompt=Hand-painted cartoony style illustration depicting a playful Celadon astronaut floating diagonally across the image, with an oversized sun dominating the background. Use loose, expressive brushwork and intentionally uneven paint application. The astronaut's spacesuit should have simplified shapes and slightly skewed proportions, creating a sense of movement against a fragmented space landscape with abstract planetary shapes scattered in the background. Has a big strawberry in the astronaughts arms" \
-F "strength=0.9" \
-F "style_id=b9af225b-6b98-43d0-a4b3-16343641e852" \
-F 'controls[colors][0][rgb][0]=255' \
-F 'controls[colors][0][rgb][1]=0' \
-F 'controls[colors][0][rgb][2]=0'
And also tried passing in the control colors in this format, which also doesn't work:
-F 'controls={"colors":[{"rgb":[255,0,0]}]}'