First time here, I am new to python atrying to resize an image for a ComfyUI node using python
import torch
import torchvision.transforms.functional as TF
from PIL import Image
class ImageResize:
def __init__(self):
pass
@classmethod
def INPUT_TYPES(cls):
return {
"required": {
"image": ("IMAGE",),
"height": ("INT", {"min": 1}),
"width": ("INT", {"min": 1}),
},
}
RETURN_TYPES = ("IMAGE",)
FUNCTION = "resize_image"
CATEGORY = "ImageProcessing"
def resize_image(self, image, height, width):
input_image = image
resized_image = TF.resize(input_image, (height, width))
return (resized_image,)
Using the above, when I adjust the height, the width changes, and when I adjust the width,
int of 1 shows cannot handle this data type: (1, 1, 1), |u1
int of 2 shows a black and white image
int of 3 shows a full colour image
int of 4 shows a dimmed colour image
5 or higher throws the same error as 1 with the last value incrementing to 5 or higher ie: Cannot handle this data type: (1, 1, 5), |u1
What am I doing wrong?
not sure why height is adjusting the width and the width doing something completely different
Grafting Rayman is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.