stable-diffusion-webui icon indicating copy to clipboard operation
stable-diffusion-webui copied to clipboard

The image generated by the paint upload has a black background

Open hjj-lmx opened this issue 1 year ago • 6 comments

Checklist

  • [ ] The issue exists after disabling all extensions
  • [ ] The issue exists on a clean installation of webui
  • [ ] The issue is caused by an extension, but I believe it is caused by a bug in the webui
  • [ ] The issue exists in the current version of the webui
  • [ ] The issue has not been reported before recently
  • [ ] The issue has been reported before but has not been fixed yet

What happened?

新建文件夹.zip

Steps to reproduce the problem

The file name 880442781713343428183.png mask caused an image problem, while the 806600451713349345060.png mask was generated normally, but there is no significant difference between the two. The first mask is generated through Cavas on the iPhone 12 phone

What should have happened?

API passed in parameters { "prompt": "white cylindrical in a snowflake,Cherry blossom tree,FelinkAI,translucent glasszbrush,Sakura and gold style, anime aestheticsfurry art, pink , elaborate, 3d,c4drendering,8k, super high detail, lora:20240119-1705594619950:1", "negative_prompt": "nsfw,logo,text,badhandv4,EasyNegative,ng_deepnegative_v1_75t,rev2-badprompt,verybadimagenegative_v1.3,negative_hand-neg,mutated hands and fingers,poorly drawn face,extra limb,missing limb,disconnected limbs,malformed hands,ugly", "styles": [], "seed": -1, "subseed": -1, "subseed_strength": 0, "seed_resize_from_h": -1, "seed_resize_from_w": -1, "sampler_name": "DPM++ 2M Karras", "batch_size": 1, "n_iter": 1, "steps": 30, "cfg_scale": 7, "width": 1024, "height": 1024, "restore_faces": true, "tiling": true, "do_not_save_samples": false, "do_not_save_grid": false, "eta": 0, "denoising_strength": 1, "s_min_uncond": 0, "s_churn": 0, "s_tmax": 0, "s_tmin": 0, "s_noise": 0, "override_settings": {}, "override_settings_restore_afterwards": true, "refiner_checkpoint": "", "refiner_switch_at": 0, "disable_extra_networks": false, "firstpass_image": "", "comments": {}, "init_images": [ "https://watermarkud.obs.cn-east-3.myhuaweicloud.com/input/2024/04/17/16/262142511713343427683.png" ], "resize_mode": 0, "image_cfg_scale": 0, "mask": "https://watermarkud.obs.cn-east-3.myhuaweicloud.com/input/2024/04/17/16/880442781713343428183.png", "mask_blur_x": 4, "mask_blur_y": 4, "mask_blur": 0, "mask_round": true, "inpainting_fill": 0, "inpaint_full_res": true, "inpaint_full_res_padding": 0, "inpainting_mask_invert": 0, "initial_noise_multiplier": 0, "latent_mask": "", "force_task_id": "", "sampler_index": "DPM++ 2M Karras", "include_init_images": false, "script_name": "", "script_args": [], "send_images": true, "save_images": false, "alwayson_scripts": {}, "infotext": "" }

What browsers do you use to access the UI ?

No response

Sysinfo

I am using version 1.8 of sdwebui Deployed on Windows system, using 3090 GPU

Console logs

*** API error: POST: http://116.211.238.55:17862/sdapi/v1/img2img {'error': 'ValueError', 'detail': '', 'body': '', 'errors': "Coordinate 'right' is less than 'left'"}
    Traceback (most recent call last):
      File "D:\stable-diffusion-webui-1.8\venv\lib\site-packages\anyio\streams\memory.py", line 98, in receive
        return self.receive_nowait()
      File "D:\stable-diffusion-webui-1.8\venv\lib\site-packages\anyio\streams\memory.py", line 93, in receive_nowait
        raise WouldBlock
    anyio.WouldBlock

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "D:\stable-diffusion-webui-1.8\venv\lib\site-packages\starlette\middleware\base.py", line 78, in call_next
        message = await recv_stream.receive()
      File "D:\stable-diffusion-webui-1.8\venv\lib\site-packages\anyio\streams\memory.py", line 118, in receive
        raise EndOfStream
    anyio.EndOfStream

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "D:\stable-diffusion-webui-1.8\modules\api\api.py", line 187, in exception_handling
        return await call_next(request)
      File "D:\stable-diffusion-webui-1.8\venv\lib\site-packages\starlette\middleware\base.py", line 84, in call_next
        raise app_exc
      File "D:\stable-diffusion-webui-1.8\venv\lib\site-packages\starlette\middleware\base.py", line 70, in coro
        await self.app(scope, receive_or_disconnect, send_no_error)
      File "D:\stable-diffusion-webui-1.8\venv\lib\site-packages\starlette\middleware\base.py", line 108, in __call__
        response = await self.dispatch_func(request, call_next)
      File "D:\stable-diffusion-webui-1.8\modules\api\api.py", line 151, in log_and_time
        res: Response = await call_next(req)
      File "D:\stable-diffusion-webui-1.8\venv\lib\site-packages\starlette\middleware\base.py", line 84, in call_next
        raise app_exc
      File "D:\stable-diffusion-webui-1.8\venv\lib\site-packages\starlette\middleware\base.py", line 70, in coro
        await self.app(scope, receive_or_disconnect, send_no_error)
      File "D:\stable-diffusion-webui-1.8\venv\lib\site-packages\starlette\middleware\cors.py", line 84, in __call__
        await self.app(scope, receive, send)
      File "D:\stable-diffusion-webui-1.8\venv\lib\site-packages\starlette\middleware\gzip.py", line 26, in __call__
        await self.app(scope, receive, send)
      File "D:\stable-diffusion-webui-1.8\venv\lib\site-packages\starlette\middleware\exceptions.py", line 79, in __call__
        raise exc
      File "D:\stable-diffusion-webui-1.8\venv\lib\site-packages\starlette\middleware\exceptions.py", line 68, in __call__
        await self.app(scope, receive, sender)
      File "D:\stable-diffusion-webui-1.8\venv\lib\site-packages\fastapi\middleware\asyncexitstack.py", line 21, in __call__
        raise e
      File "D:\stable-diffusion-webui-1.8\venv\lib\site-packages\fastapi\middleware\asyncexitstack.py", line 18, in __call__
        await self.app(scope, receive, send)
      File "D:\stable-diffusion-webui-1.8\venv\lib\site-packages\starlette\routing.py", line 718, in __call__
        await route.handle(scope, receive, send)
      File "D:\stable-diffusion-webui-1.8\venv\lib\site-packages\starlette\routing.py", line 276, in handle
        await self.app(scope, receive, send)
      File "D:\stable-diffusion-webui-1.8\venv\lib\site-packages\starlette\routing.py", line 66, in app
        response = await func(request)
      File "D:\stable-diffusion-webui-1.8\venv\lib\site-packages\fastapi\routing.py", line 237, in app
        raw_response = await run_endpoint_function(
      File "D:\stable-diffusion-webui-1.8\venv\lib\site-packages\fastapi\routing.py", line 165, in run_endpoint_function
        return await run_in_threadpool(dependant.call, **values)
      File "D:\stable-diffusion-webui-1.8\venv\lib\site-packages\starlette\concurrency.py", line 41, in run_in_threadpool
        return await anyio.to_thread.run_sync(func, *args)
      File "D:\stable-diffusion-webui-1.8\venv\lib\site-packages\anyio\to_thread.py", line 33, in run_sync
        return await get_asynclib().run_sync_in_worker_thread(
      File "D:\stable-diffusion-webui-1.8\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 877, in run_sync_in_worker_thread
        return await future
      File "D:\stable-diffusion-webui-1.8\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 807, in run
        result = context.run(func, *args)
      File "D:\stable-diffusion-webui-1.8\modules\api\api.py", line 548, in img2imgapi
        processed = process_images(p)
      File "D:\stable-diffusion-webui-1.8\modules\processing.py", line 793, in process_images
        res = process_images_inner(p)
      File "D:\stable-diffusion-webui-1.8\extensions\sd-webui-controlnet\scripts\batch_hijack.py", line 59, in processing_process_images_hijack
        return getattr(processing, '__controlnet_original_process_images_inner')(p, *args, **kwargs)
      File "D:\stable-diffusion-webui-1.8\modules\processing.py", line 863, in process_images_inner
        p.init(p.all_prompts, p.all_seeds, p.all_subseeds)
      File "D:\stable-diffusion-webui-1.8\modules\processing.py", line 1564, in init
        mask = mask.crop(crop_region)
      File "D:\stable-diffusion-webui-1.8\venv\lib\site-packages\PIL\Image.py", line 1224, in crop
        raise ValueError(msg)
    ValueError: Coordinate 'right' is less than 'left'

Additional information

No response

hjj-lmx avatar Apr 17 '24 11:04 hjj-lmx

The first mask generated an issue with the image

well it doesn't really help if you don't give the description of the issue

adding to this you also did not follow the steps and provide Console logs or Sysinfo this basically means we don't even know what the version of webui you are using and have no idea what's happening


when I test on my machine using the image you uploaded on GitHub both seems to work without any issue it is possible whatever is causing the issue in the image is removed by GitHub during the upload so can you re-upload your file package inside a zip archive

w-e-w avatar Apr 18 '24 04:04 w-e-w

.............

w-e-w avatar Apr 18 '24 05:04 w-e-w

第一个蒙版产生了图像问题

如果您不给出问题的描述,那并没有多大帮助

除此之外,您也没有按照步骤操作并提供控制台日志或 Sysinfo, 这基本上意味着我们甚至不知道您正在使用的 webui 版本是什么 ,也不知道发生了什么

当我使用您在 GitHub 上上传的图像在我的计算机上进行测试时, 两者似乎都可以正常工作,没有任何问题, 可能是在上传过程中 GitHub 删除了导致图像中问题的任何原因, 因此您可以在 zip 中重新上传文件包吗?档案

I have found the reason, it is due to the presence of pixel 254 in the image mask, which causes the image generated by the following code to be entirely white pixels

def create_binary_mask(image, round=True): if image.mode == 'RGBA' and image.getextrema()[-1] != (255, 255): if round: image = image.split()[-1].convert("L").point(lambda x: 255 if x > 128 else 0) else: image = image.split()[-1].convert("L") else: image = image.convert('L') return image

hjj-lmx avatar Apr 18 '24 05:04 hjj-lmx

.............

Modified the issue and provided parameter images, etc

hjj-lmx avatar Apr 18 '24 07:04 hjj-lmx

you need to wait till the upload has finish before comment image

w-e-w avatar Apr 18 '24 08:04 w-e-w

您需要等到上传完成后再进行comment 图像

I have resubmitted it. You can try the API interface. I have provided the complete parameters

hjj-lmx avatar Apr 18 '24 08:04 hjj-lmx