ComfyUI_UltimateSDUpscale icon indicating copy to clipboard operation
ComfyUI_UltimateSDUpscale copied to clipboard

mask image

Open za-wa-n-go opened this issue 1 year ago • 11 comments

It seems that an error occurs with images that have transparency. Is there a way to counter this?

za-wa-n-go avatar Jan 10 '24 05:01 za-wa-n-go

I didnt want to start a new issue because it is related. I want to ask if its possible to upscale images which has Alpha channel (RGBA) as they are transparent and transparency will remain same at the end of upscale process ? Anybody has an idea ? Thank you

simartem avatar Feb 05 '24 18:02 simartem

The best I think you can do is just separating the alpha and scaling it up and adding it back after the upscale on the RBG. There's probably some nodes (maybe built-in?) that let you do that, but it should be easy to add.

ssitu avatar Feb 06 '24 00:02 ssitu

The best I think you can do is just separating the alpha and scaling it up and adding it back after the upscale on the RBG. There's probably some nodes (maybe built-in?) that let you do that, but it should be easy to add.

Thank you for the reply. Actually for the solution, it was what i've tried to do, but the point is the nodes (i dont know if all of them or if the nodes in my hand) are not capable of processing/joining the mask and the image together after the upscale, because of the resolution. I couldnt find a way to join Alpha channel with RGB for dimensions over 1024x1024. I am stuck. I am surprised that chaiNNer can handle RGBA images for upscaling with the embedded transparency layer (alpha), no problems with that. But for my workflow, i have to do it one by one in chainner, need a solution in comfyui environment. And thank you again.

simartem avatar Feb 06 '24 00:02 simartem

Are you scaling the mask to the right size before adding it back in to the upscaled image? I will work on fixing this, but since stable diffusion doesn't deal with the alpha channel, the mask will just have to be resized to the larger size. Maybe chainner does the same? Or maybe upscale models can handle the alpha channel?

ssitu avatar Feb 06 '24 01:02 ssitu

Are you scaling the mask to the right size before adding it back in to the upscaled image? I will work on fixing this, but since stable diffusion doesn't deal with the alpha channel, the mask will just have to be resized to the larger size. Maybe chainner does the same? Or maybe upscale models can handle the alpha channel?

I upscale the mask with upscaler nodes, but the point is when upscaling the Alpha channel, it has to be converted into mask --> image. When the image is upscaled, I cant seem to find a way to convert it back to alpha, because the node which converts the image to ---> mask, asks me red, green, blue, alpha.. However, the upscaled image does not have any Alpha channel anymore because it is converted to RGB space. No red, no green, no blue, no alpha data.. I hope i could explain in correct way.

image

simartem avatar Feb 06 '24 02:02 simartem

Yeah I understand now. There's probably nodes you can install for that. I'll work on getting a fix for the alpha channel so that you wouldn't have to do all that though.

ssitu avatar Feb 06 '24 02:02 ssitu

Yeah I understand now. There's probably nodes you can install for that. I'll work on getting a fix for the alpha channel so that you wouldn't have to do all that though.

Thank you so much for tough work and efforts.. !

simartem avatar Feb 06 '24 02:02 simartem

Yeah I understand now. There's probably nodes you can install for that. I'll work on getting a fix for the alpha channel so that you wouldn't have to do all that though.

Hello! Thanks for your work! Could you please tell me, did you manage to find a way to upscale images with alpha channel?

YanMednis avatar May 19 '24 10:05 YanMednis

Yeah I understand now. There's probably nodes you can install for that. I'll work on getting a fix for the alpha channel so that you wouldn't have to do all that though.

Hello! Thanks for your work! Could you please tell me, did you manage to find a way to upscale images with alpha channel?

actually there is no simple way, you seperate the mask and image it self, turn the mask into RGB space (black and white), upscale them seperate, and cut the upscaled image with the upscaled mask which is a black and white image anymore. I deleted my recent files so i dont remember the details but there are some nodes to cut by the mask for your upscaled image. To sum up, upscaling a RGBA image is not possible without seperating it.

simartem avatar May 19 '24 16:05 simartem

Sorry to hijack but my issue is close enough to ask here. I want to use UltiamteSD no upscale BUT mask the face. In other words add details to everything except the face. Any ideas on how to do that?

KINGLIFER avatar Aug 01 '24 11:08 KINGLIFER

blend the upscaled image with the original one on photoshop and delete unwanted areas with feather.

simartem avatar Aug 25 '24 23:08 simartem