mirror of
https://git.datalinker.icu/kijai/ComfyUI-KJNodes.git
synced 2025-12-23 19:54:37 +08:00
Update ImageAndMaskPreview for upcoming core update
Solves https://github.com/kijai/ComfyUI-KJNodes/issues/443
This commit is contained in:
parent
c661baadd9
commit
e5935115cf
@ -20,7 +20,8 @@ except:
|
|||||||
from PIL import ImageGrab, ImageDraw, ImageFont, Image, ImageOps
|
from PIL import ImageGrab, ImageDraw, ImageFont, Image, ImageOps
|
||||||
|
|
||||||
from nodes import MAX_RESOLUTION, SaveImage
|
from nodes import MAX_RESOLUTION, SaveImage
|
||||||
from comfy_extras.nodes_mask import ImageCompositeMasked
|
from comfy_extras.nodes_mask import composite
|
||||||
|
import node_helpers
|
||||||
from comfy.cli_args import args
|
from comfy.cli_args import args
|
||||||
from comfy.utils import ProgressBar, common_upscale
|
from comfy.utils import ProgressBar, common_upscale
|
||||||
import folder_paths
|
import folder_paths
|
||||||
@ -1285,7 +1286,10 @@ nodes for example.
|
|||||||
mask_image[:, :, :, 1] = color_list[1] / 255 # Green channel
|
mask_image[:, :, :, 1] = color_list[1] / 255 # Green channel
|
||||||
mask_image[:, :, :, 2] = color_list[2] / 255 # Blue channel
|
mask_image[:, :, :, 2] = color_list[2] / 255 # Blue channel
|
||||||
|
|
||||||
preview, = ImageCompositeMasked.composite(self, image, mask_image, 0, 0, True, mask_adjusted)
|
destination, source = node_helpers.image_alpha_fix(image, mask_image)
|
||||||
|
destination = destination.clone().movedim(-1, 1)
|
||||||
|
preview = composite(destination, source.movedim(-1, 1), 0, 0, mask_adjusted, 1, True).movedim(1, -1)
|
||||||
|
|
||||||
if pass_through:
|
if pass_through:
|
||||||
return (preview, )
|
return (preview, )
|
||||||
return(self.save_images(preview, filename_prefix, prompt, extra_pnginfo))
|
return(self.save_images(preview, filename_prefix, prompt, extra_pnginfo))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user