mirror of
https://github.com/invoke-ai/InvokeAI.git
synced 2026-04-23 03:00:31 -04:00
Gemini 2.5 Flash makes no guarantees about output image sizes. Our existing logic always rendered staged images on Canvas at the bbox dims - not the image's physical dimensions. When Gemini returns an image that doesn't match the bbox, it would get squished. To rectify this, the canvas staging area renderer is updated to render its images using their physical dimensions, as opposed to their configured dimensions (i.e. bbox). A flag on CanvasObjectImage enables this rendering behaviour. Then, when saving the image as a layer from staging area, we use the physical dimensions. When the bbox and physical dimensions do not match, the bbox is not touched, so it won't exactly encompass the staged image. No point in resizing the bbox if the dimensions don't match - the next image could be a different size, and the sizes might not be valid (it's an external resource, after all).