Compare commits

...

2 Commits

Author SHA1 Message Date
psychedelicious
a57f56efa5 chore(ui): typegen 2025-04-10 11:22:00 +10:00
psychedelicious
5fffaede54 fix(nodes): img_conv node should only allow conversion to modes that it can save
Because all our nodes output images in PNG format, any mode not supported by the PNG file format will result in an error when saving the image. The valid modes are thus limited now to L, RGB, RGBA, and I.
2025-04-10 11:21:45 +10:00
2 changed files with 6 additions and 4 deletions

View File

@@ -11,7 +11,6 @@ from invokeai.app.invocations.baseinvocation import (
Classification,
invocation,
)
from invokeai.app.invocations.constants import IMAGE_MODES
from invokeai.app.invocations.fields import (
BoundingBoxField,
ColorField,
@@ -268,18 +267,21 @@ class ImageChannelInvocation(BaseInvocation, WithMetadata, WithBoard):
return ImageOutput.build(image_dto)
PNG_IMAGE_MODES = Literal["L", "RGB", "RGBA", "I"]
@invocation(
"img_conv",
title="Convert Image Mode",
tags=["image", "convert"],
category="image",
version="1.2.2",
version="2.0.0",
)
class ImageConvertInvocation(BaseInvocation, WithMetadata, WithBoard):
"""Converts an image to a different mode."""
image: ImageField = InputField(description="The image to convert")
mode: IMAGE_MODES = InputField(default="L", description="The mode to convert to")
mode: PNG_IMAGE_MODES = InputField(default="L", description="The mode to convert to")
def invoke(self, context: InvocationContext) -> ImageOutput:
image = context.images.get_pil(self.image.image_name)

View File

@@ -9638,7 +9638,7 @@ export type components = {
* @default L
* @enum {string}
*/
mode?: "L" | "RGB" | "RGBA" | "CMYK" | "YCbCr" | "LAB" | "HSV" | "I" | "F";
mode?: "L" | "RGB" | "RGBA" | "I";
/**
* type
* @default img_conv