- Newest
- Most votes
- Most comments
CJ, it looks like there are a couple errors in our documentation that are getting in the way of you achieving the effect you want.
You are correct that the text parameter is required when using the "OUTPAINTING" task type (it is optional for some other task types.) For an image extension case like this, it's best practice to use a text prompt that describe what the finished image should look like as a whole. In this case "man crossing the street in a city" might be appropriate.
The reason you aren't getting the result you expect is that your mask is inverted. When using outpainting, black areas represent the areas of the original image that should remain intact and white indicates areas where new content should be generated. This is the opposite of inpainting, where black represents what to change and white indicates what should remain unchanged.
I'll make sure we update the documentation to make the above clearer and more accurate.
I understand you're experiencing difficulties with the outpainting feature of the AWS Nova Canvas model. Let me provide some insights and suggestions based on the information you've shared.
First, regarding the text field in the request body: While the documentation may suggest that no text is needed, it appears that the model does require at least a blank character in the text field to avoid a client-side error. This is likely a technical requirement of the API, even if not explicitly stated in the documentation.
For outpainting to work effectively, here are some key points to consider:
-
Text prompt: The text prompt should describe what you want the entire image to look like, including both the existing parts and the areas to be generated. For example, instead of just "A city street," you might try something more descriptive like "A bustling city street with tall buildings, pedestrians, and cars, extending the existing scene."
-
Mask: Ensure your mask image is correctly formatted. It should be pure black and white, with white areas indicating where new content should be generated. The mask should align perfectly with your input image.
-
Image preparation: Make sure your input image doesn't contain any transparent or translucent pixels, as these are not supported by the model.
-
Resolution: Both the input image and the mask should have dimensions that are multiples of 16 pixels.
-
Outpainting mode: In your request, you can specify the outpainting mode. Try using "PRECISE" mode if you want to preserve the exact pixels of the masked image when extending it.
Based on your results, it seems the model is generating content, but it's not seamlessly extending the existing image as expected. This could be due to the brevity of your prompt or the way the mask is interpreted.
To improve your results:
- Use a more detailed and specific text prompt that describes the entire desired scene.
- Double-check your mask to ensure it's correctly indicating the areas to be generated.
- Experiment with different outpainting modes (DEFAULT vs PRECISE).
- If possible, try adjusting the cfg_scale parameter in your request to control how closely the generation adheres to your prompt.
Remember, outpainting works best when the prompt describes the entire desired image, not just the new areas to be generated. Keep experimenting with different prompts and settings to achieve the results you're looking for.
Sources
Outpainting prompts - Amazon Nova
Generating images with Amazon Nova - Amazon Nova
Image generation access and usage - Amazon Nova
answered 2 years ago
This answer doesn't reflect the correct interpretation of the mask according to the documentation. The area to be edited is black the area to ignore is white.
Hi,
I would strongly recommend that you start from the code examples of this pages: https://docs.aws.amazon.com/nova/latest/userguide/image-gen-code-examples.html.
My recommendation is to get them to work as-is and then incrementally adapt them toward your goal.
This article also provides working samples with Canvas: https://aws.plainenglish.io/changing-image-background-using-amazon-bedrock-nova-canvas-model-and-outpainting-60b8795b564e
Best,
Didier
Switching the black/white gets us going. I'm also seeing a JSON malformed Error when adding the outPaintingMode to the outPaintingParams key.
answered 2 years ago
Relevant content
asked 2 years ago
asked a year ago
asked 2 years ago

Hey Kris, apologies if this gets sent your way twice. Wanted to make you aware: I'm also seeing a JSON malformed Error when adding the outPaintingMode to the outPaintingParams key. Cheers.
CJ, I'm not sure why you would be getting that JSON error. Can you paste the full error here? Also, you might try cross-referencing your code with the examples in our documentation to see what may be different between the two.
This is the response: Client error: Malformed input request: #/outPaintingParams: extraneous key [outpaintingMode] is not permitted, please reformat your input and try again. This is the only Tasktype that delivers an error when creating the params for the task. All of the code is available for the app @ https://github.com/HatmanStack/canvas-demo . The relevant code is in functions.py in def outpainting. If you could test it locally? Maybe it's something on my end.
Hey Kris, Thanks for the help. Just a slight grammar error with camelcase to clean it up and get it going.