mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
fix(nodes): canny preprocessor uses RGBA again
This commit is contained in:
parent
d17a0779cc
commit
5e14c90f94
@ -143,8 +143,12 @@ class ImageProcessorInvocation(BaseInvocation, WithMetadata, WithBoard):
|
|||||||
# superclass just passes through image without processing
|
# superclass just passes through image without processing
|
||||||
return image
|
return image
|
||||||
|
|
||||||
|
def load_image(self, context: InvocationContext) -> Image.Image:
|
||||||
|
# allows override for any special formatting specific to the preprocessor
|
||||||
|
return context.images.get_pil(self.image.image_name, "RGB")
|
||||||
|
|
||||||
def invoke(self, context: InvocationContext) -> ImageOutput:
|
def invoke(self, context: InvocationContext) -> ImageOutput:
|
||||||
raw_image = context.images.get_pil(self.image.image_name, "RGB")
|
raw_image = self.load_image(context)
|
||||||
# image type should be PIL.PngImagePlugin.PngImageFile ?
|
# image type should be PIL.PngImagePlugin.PngImageFile ?
|
||||||
processed_image = self.run_processor(raw_image)
|
processed_image = self.run_processor(raw_image)
|
||||||
|
|
||||||
@ -181,6 +185,10 @@ class CannyImageProcessorInvocation(ImageProcessorInvocation):
|
|||||||
default=200, ge=0, le=255, description="The high threshold of the Canny pixel gradient (0-255)"
|
default=200, ge=0, le=255, description="The high threshold of the Canny pixel gradient (0-255)"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def load_image(self, context: InvocationContext) -> Image.Image:
|
||||||
|
# Keep alpha channel for Canny processing to detect edges of transparent areas
|
||||||
|
return context.images.get_pil(self.image.image_name, "RGBA")
|
||||||
|
|
||||||
def run_processor(self, image):
|
def run_processor(self, image):
|
||||||
canny_processor = CannyDetector()
|
canny_processor = CannyDetector()
|
||||||
processed_image = canny_processor(image, self.low_threshold, self.high_threshold)
|
processed_image = canny_processor(image, self.low_threshold, self.high_threshold)
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
Subproject commit aae207914f08f77324691ae984fae6dabb0b8976
|
Loading…
Reference in New Issue
Block a user