|
|
@ -1192,6 +1192,26 @@ class ImageScale: |
|
|
|
s = s.movedim(1,-1) |
|
|
|
s = s.movedim(1,-1) |
|
|
|
return (s,) |
|
|
|
return (s,) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ImageScaleBy: |
|
|
|
|
|
|
|
upscale_methods = ["nearest-exact", "bilinear", "area"] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@classmethod |
|
|
|
|
|
|
|
def INPUT_TYPES(s): |
|
|
|
|
|
|
|
return {"required": { "image": ("IMAGE",), "upscale_method": (s.upscale_methods,), |
|
|
|
|
|
|
|
"scale_by": ("FLOAT", {"default": 1.0, "min": 0.01, "max": 8.0, "step": 0.01}),}} |
|
|
|
|
|
|
|
RETURN_TYPES = ("IMAGE",) |
|
|
|
|
|
|
|
FUNCTION = "upscale" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CATEGORY = "image/upscaling" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def upscale(self, image, upscale_method, scale_by): |
|
|
|
|
|
|
|
samples = image.movedim(-1,1) |
|
|
|
|
|
|
|
width = round(samples.shape[3] * scale_by) |
|
|
|
|
|
|
|
height = round(samples.shape[2] * scale_by) |
|
|
|
|
|
|
|
s = comfy.utils.common_upscale(samples, width, height, upscale_method, "disabled") |
|
|
|
|
|
|
|
s = s.movedim(1,-1) |
|
|
|
|
|
|
|
return (s,) |
|
|
|
|
|
|
|
|
|
|
|
class ImageInvert: |
|
|
|
class ImageInvert: |
|
|
|
|
|
|
|
|
|
|
|
@classmethod |
|
|
|
@classmethod |
|
|
@ -1290,6 +1310,7 @@ NODE_CLASS_MAPPINGS = { |
|
|
|
"LoadImage": LoadImage, |
|
|
|
"LoadImage": LoadImage, |
|
|
|
"LoadImageMask": LoadImageMask, |
|
|
|
"LoadImageMask": LoadImageMask, |
|
|
|
"ImageScale": ImageScale, |
|
|
|
"ImageScale": ImageScale, |
|
|
|
|
|
|
|
"ImageScaleBy": ImageScaleBy, |
|
|
|
"ImageInvert": ImageInvert, |
|
|
|
"ImageInvert": ImageInvert, |
|
|
|
"ImagePadForOutpaint": ImagePadForOutpaint, |
|
|
|
"ImagePadForOutpaint": ImagePadForOutpaint, |
|
|
|
"ConditioningAverage ": ConditioningAverage , |
|
|
|
"ConditioningAverage ": ConditioningAverage , |
|
|
@ -1371,6 +1392,7 @@ NODE_DISPLAY_NAME_MAPPINGS = { |
|
|
|
"LoadImage": "Load Image", |
|
|
|
"LoadImage": "Load Image", |
|
|
|
"LoadImageMask": "Load Image (as Mask)", |
|
|
|
"LoadImageMask": "Load Image (as Mask)", |
|
|
|
"ImageScale": "Upscale Image", |
|
|
|
"ImageScale": "Upscale Image", |
|
|
|
|
|
|
|
"ImageScaleBy": "Upscale Image By", |
|
|
|
"ImageUpscaleWithModel": "Upscale Image (using Model)", |
|
|
|
"ImageUpscaleWithModel": "Upscale Image (using Model)", |
|
|
|
"ImageInvert": "Invert Image", |
|
|
|
"ImageInvert": "Invert Image", |
|
|
|
"ImagePadForOutpaint": "Pad Image for Outpainting", |
|
|
|
"ImagePadForOutpaint": "Pad Image for Outpainting", |
|
|
|