Mikubill / sd-webui-controlnet

WebUI extension for ControlNet
GNU General Public License v3.0
16.42k stars 1.91k forks source link

[Bug]: Input image asserts too restrictive #2870

Closed proc-sim closed 1 month ago

proc-sim commented 1 month ago

Is there an existing issue for this?

What happened?

In args.py, line 284 you have the following check:

assert np_image.shape[2] == 3

This checks that the input image has 3 channels, and will fail if the input image has 4 channels (ex: an RGBA PNG). However, there doesn't seem to be any downstream issues that occur if an image has 4 channels (by removing that check I still get a coherent result).

I think the check should be changed to:

assert np_image.shape[2] >= 3

That way the whole pipeline won't fail if an input image has an alpha channel.

Steps to reproduce the problem

Specify an image with alpha as input.

What should have happened?

No assert if the image has alpha.

Commit where the problem happens

Latest

What browsers do you use to access the UI ?

No response

Command Line Arguments

"image" = {base64 PNG w/alpha}

List of enabled extensions

N/A

Console logs

N/A

Additional information

No response