zero01101 / openOutpaint

local offline javascript and html canvas outpainting gizmo for stable diffusion webUI API šŸ 
MIT License
499 stars 43 forks source link

[Bug]: Img2Img "right is less than left" error #209

Open jwvanderbeck opened 1 year ago

jwvanderbeck commented 1 year ago

What happened?

When I try to do an Img2Img tile, I get an error in the console and a blank render.

Steps to reproduce the problem

  1. Select the Img2Img tool
  2. Click on an existing part of the image

What should have happened?

Img2Img should have run

Commit where the problem happens

989a3fa0

What platforms do you use to access openOutpaint?

Windows

What browsers do you use to access the UI ?

Google Chrome

Browser Extensions/Addons

1password

AUTOMATIC1111 webUI Commandline Arguments

--api --listen

Additional information

Traceback (most recent call last):
  File "D:\Developer\stable-diffusion-webui\venv\lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 407, in run_asgi
    result = await app(  # type: ignore[func-returns-value]
  File "D:\Developer\stable-diffusion-webui\venv\lib\site-packages\uvicorn\middleware\proxy_headers.py", line 78, in __call__
    return await self.app(scope, receive, send)
  File "D:\Developer\stable-diffusion-webui\venv\lib\site-packages\fastapi\applications.py", line 271, in __call__
    await super().__call__(scope, receive, send)
  File "D:\Developer\stable-diffusion-webui\venv\lib\site-packages\starlette\applications.py", line 125, in __call__
    await self.middleware_stack(scope, receive, send)
  File "D:\Developer\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\errors.py", line 184, in __call__
    raise exc
  File "D:\Developer\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\errors.py", line 162, in __call__
    await self.app(scope, receive, _send)
  File "D:\Developer\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\base.py", line 104, in __call__
    response = await self.dispatch_func(request, call_next)
  File "D:\Developer\stable-diffusion-webui\modules\api\api.py", line 96, in log_and_time
    res: Response = await call_next(req)
  File "D:\Developer\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\base.py", line 80, in call_next
    raise app_exc
  File "D:\Developer\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\base.py", line 69, in coro
    await self.app(scope, receive_or_disconnect, send_no_error)
  File "D:\Developer\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\gzip.py", line 24, in __call__
    await responder(scope, receive, send)
  File "D:\Developer\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\gzip.py", line 44, in __call__
    await self.app(scope, receive, self.send_with_gzip)
  File "D:\Developer\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\exceptions.py", line 79, in __call__
    raise exc
  File "D:\Developer\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\exceptions.py", line 68, in __call__
    await self.app(scope, receive, sender)
  File "D:\Developer\stable-diffusion-webui\venv\lib\site-packages\fastapi\middleware\asyncexitstack.py", line 21, in __call__
    raise e
  File "D:\Developer\stable-diffusion-webui\venv\lib\site-packages\fastapi\middleware\asyncexitstack.py", line 18, in __call__
    await self.app(scope, receive, send)
  File "D:\Developer\stable-diffusion-webui\venv\lib\site-packages\starlette\routing.py", line 706, in __call__
    await route.handle(scope, receive, send)
  File "D:\Developer\stable-diffusion-webui\venv\lib\site-packages\starlette\routing.py", line 276, in handle
    await self.app(scope, receive, send)
  File "D:\Developer\stable-diffusion-webui\venv\lib\site-packages\starlette\routing.py", line 66, in app
    response = await func(request)
  File "D:\Developer\stable-diffusion-webui\venv\lib\site-packages\fastapi\routing.py", line 237, in app
    raw_response = await run_endpoint_function(
  File "D:\Developer\stable-diffusion-webui\venv\lib\site-packages\fastapi\routing.py", line 165, in run_endpoint_function
    return await run_in_threadpool(dependant.call, **values)
  File "D:\Developer\stable-diffusion-webui\venv\lib\site-packages\starlette\concurrency.py", line 41, in run_in_threadpool
    return await anyio.to_thread.run_sync(func, *args)
  File "D:\Developer\stable-diffusion-webui\venv\lib\site-packages\anyio\to_thread.py", line 31, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "D:\Developer\stable-diffusion-webui\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 937, in run_sync_in_worker_thread
    return await future
  File "D:\Developer\stable-diffusion-webui\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 867, in run
    result = context.run(func, *args)
  File "D:\Developer\stable-diffusion-webui\modules\api\api.py", line 246, in img2imgapi
    processed = process_images(p)
  File "D:\Developer\stable-diffusion-webui\modules\processing.py", line 486, in process_images
    res = process_images_inner(p)
  File "D:\Developer\stable-diffusion-webui\modules\processing.py", line 577, in process_images_inner
    p.init(p.all_prompts, p.all_seeds, p.all_subseeds)
  File "D:\Developer\stable-diffusion-webui\modules\processing.py", line 953, in init
    mask = mask.crop(crop_region)
  File "D:\Developer\stable-diffusion-webui\venv\lib\site-packages\PIL\Image.py", line 1228, in crop
    raise ValueError(msg)
ValueError: Coordinate 'right' is less than 'left'
zero01101 commented 1 year ago

lmao i don't even know how or WHERE that could occur; out of curiosity, were you possibly dragging a non-square reticle?

actually, googling the "right is less than left" error seems to suggest that it's happened in webUI previously; are you possibly using an outdated webUI?

jwvanderbeck commented 1 year ago

Webui is up to date and I tried both a square and non square. That said I THINK I know what caused this. I ran into the same error in the webui after posting this, and in that case the error was occuring because I had the mode set to inpaint but had not drawn a mask.

Here I was also not drawing a mask as what I was hoping to do was simply a standard img2img on the whole tile as if I had passed the tile into the im2img (not inpaint) function. Maybe this is not supported though or I had the wrong options set.

zero01101 commented 1 year ago

lol somewhat ironically the links both mentioned no mask being painted, but in this case.... yeah, that should definitely be a supported use case; for example i can take my default testfish
image and simply change the prompt to "a submarine" and slap img2img over it
image

technically a mask should be supplied whether or not you've manually defined one, it just might be a 100% blank or full mask depending on your invert mask option setting, but i still can't quite work out how no mask would've been passed to the API in the first place :/

illusive-c commented 1 year ago

I got that too. Click on the blue or red mask icon: image

or, clear out your mask and it'll go away