Skip to content

Commit 85f98ab

Browse files
fix(app): error on upload + resize for unusual image modes
1 parent dac7568 commit 85f98ab

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

invokeai/app/api/routers/images.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,9 @@ async def upload_image(
9999
raise HTTPException(status_code=400, detail="Invalid resize_to format or size")
100100

101101
try:
102-
np_image = pil_to_np(pil_image)
102+
# heuristic_resize_fast expects an RGB or RGBA image
103+
pil_rgba = pil_image.convert("RGBA")
104+
np_image = pil_to_np(pil_rgba)
103105
np_image = heuristic_resize_fast(np_image, (resize_dims.width, resize_dims.height))
104106
pil_image = np_to_pil(np_image)
105107
except Exception:

0 commit comments

Comments
 (0)