Resize methods
Zarxrax opened this issue · 7 comments
Can you add additional resize methods other than bicubic?
Could you tell me what the point is? Bicubic seems to do a good job in any of the relevant cases, and resizing performance shouldn’t matter compared to the rest of the pipeline.
Actually, after some more testing, the output from your node looks like nearest neighbor resize for some reason. I did a bicubic resize in another application and it looks fine. So I guess my issue isn't necessarily that there need to be more resize methods, but maybe that there is some issue causing the output to look horrible.
See the two attached images. In the one I saved from your node, the image becomes a mess of pixels and the halftone pattern becomes enlarged and very prominent.
Interesting. Can you give me the original image as well? I’ll look into it.
Edit: Looked into it briefly and my upscaling approach isn’t really different from what ComfyUI is doing. Whatever the problem, the issue must be in PyTorch.
Thank you, got your results reproduced. Also confirmed that the regular Upscale Image node produces the exact same results when using bilinear and bicubic methods (nearest-exact looks slightly differently but not actually better). Will check this out but given how we are talking about PyTorch code this might take some time.
At least I can already suspect where the issue is: the PyTorch function in question is called upsample_bicubic2d
, so it’s probably not meant to be used for reducing image size.
Found the clue in the documentation:
Using anti-alias option together with align_corners=False, interpolation result would match Pillow result for downsampling operation.
In fact, adding antialias=True
fixes this issue. Appears to have zero effect on upscaling. Will need to test further, but not today any more.