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

[Bug]: {'error': 'ValueError', 'detail': '', 'body': '', 'errors': 'height and width must be > 0'}

Open xieqing520 opened this issue 1 year ago • 1 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues and checked the recent builds/commits

What happened?

When I call the img2img API, sometimes this error is reported, but if I don't use graffiti without mask parameters, there is no problem

Steps to reproduce the problem

call img2img api with mak param

What should have happened?

`API error: POST: http://127.0.0.1:7161/sdapi/v1/img2img {'error': 'ValueError', 'detail': '', 'body': '', 'errors': 'height and width must be > 0'} Traceback (most recent call last): File "/root/miniconda3/envs/xl_env/lib/python3.10/site-packages/anyio/streams/memory.py", line 94, in receive return self.receive_nowait() File "/root/miniconda3/envs/xl_env/lib/python3.10/site-packages/anyio/streams/memory.py", line 89, in receive_nowait raise WouldBlock anyio.WouldBlock

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/root/miniconda3/envs/xl_env/lib/python3.10/site-packages/starlette/middleware/base.py", line 78, in call_next message = await recv_stream.receive() File "/root/miniconda3/envs/xl_env/lib/python3.10/site-packages/anyio/streams/memory.py", line 114, in receive raise EndOfStream anyio.EndOfStream

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/root/autodl-tmp/stable-diffusion-webui/modules/api/api.py", line 152, in exception_handling return await call_next(request) File "/root/miniconda3/envs/xl_env/lib/python3.10/site-packages/starlette/middleware/base.py", line 84, in call_next raise app_exc File "/root/miniconda3/envs/xl_env/lib/python3.10/site-packages/starlette/middleware/base.py", line 70, in coro await self.app(scope, receive_or_disconnect, send_no_error) File "/root/miniconda3/envs/xl_env/lib/python3.10/site-packages/starlette/middleware/base.py", line 108, in call response = await self.dispatch_func(request, call_next) File "/root/autodl-tmp/stable-diffusion-webui/modules/api/api.py", line 117, in log_and_time res: Response = await call_next(req) File "/root/miniconda3/envs/xl_env/lib/python3.10/site-packages/starlette/middleware/base.py", line 84, in call_next raise app_exc File "/root/miniconda3/envs/xl_env/lib/python3.10/site-packages/starlette/middleware/base.py", line 70, in coro await self.app(scope, receive_or_disconnect, send_no_error) File "/root/miniconda3/envs/xl_env/lib/python3.10/site-packages/starlette/middleware/cors.py", line 84, in call await self.app(scope, receive, send) File "/root/miniconda3/envs/xl_env/lib/python3.10/site-packages/starlette/middleware/gzip.py", line 24, in call await responder(scope, receive, send) File "/root/miniconda3/envs/xl_env/lib/python3.10/site-packages/starlette/middleware/gzip.py", line 44, in call await self.app(scope, receive, self.send_with_gzip) File "/root/miniconda3/envs/xl_env/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 79, in call raise exc File "/root/miniconda3/envs/xl_env/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 68, in call await self.app(scope, receive, sender) File "/root/miniconda3/envs/xl_env/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 21, in call raise e File "/root/miniconda3/envs/xl_env/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in call await self.app(scope, receive, send) File "/root/miniconda3/envs/xl_env/lib/python3.10/site-packages/starlette/routing.py", line 718, in call await route.handle(scope, receive, send) File "/root/miniconda3/envs/xl_env/lib/python3.10/site-packages/starlette/routing.py", line 276, in handle await self.app(scope, receive, send) File "/root/miniconda3/envs/xl_env/lib/python3.10/site-packages/starlette/routing.py", line 66, in app response = await func(request) File "/root/miniconda3/envs/xl_env/lib/python3.10/site-packages/fastapi/routing.py", line 237, in app raw_response = await run_endpoint_function( File "/root/miniconda3/envs/xl_env/lib/python3.10/site-packages/fastapi/routing.py", line 165, in run_endpoint_function return await run_in_threadpool(dependant.call, **values) File "/root/miniconda3/envs/xl_env/lib/python3.10/site-packages/starlette/concurrency.py", line 41, in run_in_threadpool return await anyio.to_thread.run_sync(func, *args) File "/root/miniconda3/envs/xl_env/lib/python3.10/site-packages/anyio/to_thread.py", line 31, in run_sync return await get_asynclib().run_sync_in_worker_thread( File "/root/miniconda3/envs/xl_env/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 937, in run_sync_in_worker_thread return await future File "/root/miniconda3/envs/xl_env/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 867, in run result = context.run(func, *args) File "/root/autodl-tmp/stable-diffusion-webui/modules/api/api.py", line 392, in img2imgapi processed = process_images(p) File "/root/autodl-tmp/stable-diffusion-webui/modules/processing.py", line 610, in process_images res = process_images_inner(p) File "/root/autodl-tmp/stable-diffusion-webui/modules/processing.py", line 670, in process_images_inner p.init(p.all_prompts, p.all_seeds, p.all_subseeds) File "/root/autodl-tmp/stable-diffusion-webui/modules/processing.py", line 1161, in init image_mask = images.resize_image(2, mask, self.width, self.height) File "/root/autodl-tmp/stable-diffusion-webui/modules/images.py", line 305, in resize_image res.paste(resized.resize((width, fill_height), box=(0, 0, width, 0)), box=(0, 0)) File "/root/miniconda3/envs/xl_env/lib/python3.10/site-packages/PIL/Image.py", line 2193, in resize return self._new(self.im.resize(size, resample, box)) ValueError: height and width must be > 0`

Commit where the problem happens

master

What Python version are you running on ?

Python 3.10.x

What platforms do you use to access the UI ?

Linux

What device are you running WebUI on?

Other GPUs

What browsers do you use to access the UI ?

Google Chrome

Command Line Arguments

*

List of extensions

Console logs

`API error: POST: http://127.0.0.1:7161/sdapi/v1/img2img {'error': 'ValueError', 'detail': '', 'body': '', 'errors': 'height and width must be > 0'}
Traceback (most recent call last):
  File "/root/miniconda3/envs/xl_env/lib/python3.10/site-packages/anyio/streams/memory.py", line 94, in receive
    return self.receive_nowait()
  File "/root/miniconda3/envs/xl_env/lib/python3.10/site-packages/anyio/streams/memory.py", line 89, in receive_nowait
    raise WouldBlock
anyio.WouldBlock

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/root/miniconda3/envs/xl_env/lib/python3.10/site-packages/starlette/middleware/base.py", line 78, in call_next
    message = await recv_stream.receive()
  File "/root/miniconda3/envs/xl_env/lib/python3.10/site-packages/anyio/streams/memory.py", line 114, in receive
    raise EndOfStream
anyio.EndOfStream

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/root/autodl-tmp/stable-diffusion-webui/modules/api/api.py", line 152, in exception_handling
    return await call_next(request)
  File "/root/miniconda3/envs/xl_env/lib/python3.10/site-packages/starlette/middleware/base.py", line 84, in call_next
    raise app_exc
  File "/root/miniconda3/envs/xl_env/lib/python3.10/site-packages/starlette/middleware/base.py", line 70, in coro
    await self.app(scope, receive_or_disconnect, send_no_error)
  File "/root/miniconda3/envs/xl_env/lib/python3.10/site-packages/starlette/middleware/base.py", line 108, in __call__
    response = await self.dispatch_func(request, call_next)
  File "/root/autodl-tmp/stable-diffusion-webui/modules/api/api.py", line 117, in log_and_time
    res: Response = await call_next(req)
  File "/root/miniconda3/envs/xl_env/lib/python3.10/site-packages/starlette/middleware/base.py", line 84, in call_next
    raise app_exc
  File "/root/miniconda3/envs/xl_env/lib/python3.10/site-packages/starlette/middleware/base.py", line 70, in coro
    await self.app(scope, receive_or_disconnect, send_no_error)
  File "/root/miniconda3/envs/xl_env/lib/python3.10/site-packages/starlette/middleware/cors.py", line 84, in __call__
    await self.app(scope, receive, send)
  File "/root/miniconda3/envs/xl_env/lib/python3.10/site-packages/starlette/middleware/gzip.py", line 24, in __call__
    await responder(scope, receive, send)
  File "/root/miniconda3/envs/xl_env/lib/python3.10/site-packages/starlette/middleware/gzip.py", line 44, in __call__
    await self.app(scope, receive, self.send_with_gzip)
  File "/root/miniconda3/envs/xl_env/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 79, in __call__
    raise exc
  File "/root/miniconda3/envs/xl_env/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 68, in __call__
    await self.app(scope, receive, sender)
  File "/root/miniconda3/envs/xl_env/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 21, in __call__
    raise e
  File "/root/miniconda3/envs/xl_env/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
    await self.app(scope, receive, send)
  File "/root/miniconda3/envs/xl_env/lib/python3.10/site-packages/starlette/routing.py", line 718, in __call__
    await route.handle(scope, receive, send)
  File "/root/miniconda3/envs/xl_env/lib/python3.10/site-packages/starlette/routing.py", line 276, in handle
    await self.app(scope, receive, send)
  File "/root/miniconda3/envs/xl_env/lib/python3.10/site-packages/starlette/routing.py", line 66, in app
    response = await func(request)
  File "/root/miniconda3/envs/xl_env/lib/python3.10/site-packages/fastapi/routing.py", line 237, in app
    raw_response = await run_endpoint_function(
  File "/root/miniconda3/envs/xl_env/lib/python3.10/site-packages/fastapi/routing.py", line 165, in run_endpoint_function
    return await run_in_threadpool(dependant.call, **values)
  File "/root/miniconda3/envs/xl_env/lib/python3.10/site-packages/starlette/concurrency.py", line 41, in run_in_threadpool
    return await anyio.to_thread.run_sync(func, *args)
  File "/root/miniconda3/envs/xl_env/lib/python3.10/site-packages/anyio/to_thread.py", line 31, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "/root/miniconda3/envs/xl_env/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 937, in run_sync_in_worker_thread
    return await future
  File "/root/miniconda3/envs/xl_env/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 867, in run
    result = context.run(func, *args)
  File "/root/autodl-tmp/stable-diffusion-webui/modules/api/api.py", line 392, in img2imgapi
    processed = process_images(p)
  File "/root/autodl-tmp/stable-diffusion-webui/modules/processing.py", line 610, in process_images
    res = process_images_inner(p)
  File "/root/autodl-tmp/stable-diffusion-webui/modules/processing.py", line 670, in process_images_inner
    p.init(p.all_prompts, p.all_seeds, p.all_subseeds)
  File "/root/autodl-tmp/stable-diffusion-webui/modules/processing.py", line 1161, in init
    image_mask = images.resize_image(2, mask, self.width, self.height)
  File "/root/autodl-tmp/stable-diffusion-webui/modules/images.py", line 305, in resize_image
    res.paste(resized.resize((width, fill_height), box=(0, 0, width, 0)), box=(0, 0))
  File "/root/miniconda3/envs/xl_env/lib/python3.10/site-packages/PIL/Image.py", line 2193, in resize
    return self._new(self.im.resize(size, resample, box))
ValueError: height and width must be > 0`

Additional information

nothing

xieqing520 avatar Jun 25 '23 12:06 xieqing520

same error

xiaosai666 avatar Jun 30 '23 07:06 xiaosai666

same here

yeeyou avatar Jul 12 '23 05:07 yeeyou

same error

jaycecd avatar Jul 13 '23 07:07 jaycecd

same error

focusjava avatar Jul 17 '23 02:07 focusjava