Repository: stable-diffusion-webui
Issue: using API's "script_name" throws and error only :(
Labels: bug-report

### Is there an existing issue for this?

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

### What happened?

Hey guys, I am pretty stuck with this :( > I am building a custom plugin for Automatic1111 API to Unity/C# using mainly the img2img section. By default, everything works fine - now, if I try to call an extension script via API - for example "script_name": "Depth aware img2img mask" - to get a quick depthmap - I constanty recieve an 500 Error ( "Invalid encoded image" ) - If I comment the "script_name" element out of the JSON, everything works fine. What did I miss? 

Is there any documentation or help? - I hope you guy could give me a kickstart for this! I would really apreciate!!!

### Steps to reproduce the problem

1. Call API with img2img section with base64 image attached
2. Add "script_name" element
3. 500 error return :/

### What should have happened?

The API should return the prompted image + a depthmap

### Commit where the problem happens

python: 3.10.9  •  torch: 1.12.1+cu113  •  xformers: N/A  •  gradio: 3.16.2  •  commit: ea9bd9fc  •  checkpoint: fe4efff1e1

### What platforms do you use to access the UI ?

Windows

### What browsers do you use to access the UI ?

Mozilla Firefox

### Command Line Arguments

```Shell
@echo off

set PYTHON=
set GIT=
set VENV_DIR=
set COMMANDLINE_ARGS= --api --listen --cors-allow-origins=*
call webui.bat
```


### List of extensions

Depth aware img2img mask

### Console logs

```Shell
File "C:\Users\SimonOakey\stable-diffusion-webui\venv\lib\site-packages\anyio\streams\memory.py", line 94, in receive
    return self.receive_nowait()
  File "C:\Users\SimonOakey\stable-diffusion-webui\venv\lib\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 "C:\Users\SimonOakey\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\base.py", line 77, in call_next
    message = await recv_stream.receive()
  File "C:\Users\SimonOakey\stable-diffusion-webui\venv\lib\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 "C:\Users\SimonOakey\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 "C:\Users\SimonOakey\stable-diffusion-webui\venv\lib\site-packages\uvicorn\middleware\proxy_headers.py", line 78, in __call__
    return await self.app(scope, receive, send)
  File "C:\Users\SimonOakey\stable-diffusion-webui\venv\lib\site-packages\fastapi\applications.py", line 270, in __call__
    await super().__call__(scope, receive, send)
  File "C:\Users\SimonOakey\stable-diffusion-webui\venv\lib\site-packages\starlette\applications.py", line 124, in __call__
    await self.middleware_stack(scope, receive, send)
  File "C:\Users\SimonOakey\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\errors.py", line 184, in __call__
    raise exc
  File "C:\Users\SimonOakey\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\errors.py", line 162, in __call__
    await self.app(scope, receive, _send)
  File "C:\Users\SimonOakey\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\base.py", line 106, in __call__
    response = await self.dispatch_func(request, call_next)
  File "C:\Users\SimonOakey\stable-diffusion-webui\modules\api\api.py", line 96, in log_and_time
    res: Response = await call_next(req)
  File "C:\Users\SimonOakey\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\base.py", line 80, in call_next
    raise app_exc
  File "C:\Users\SimonOakey\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 "C:\Users\SimonOakey\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\gzip.py", line 24, in __call__
    await responder(scope, receive, send)
  File "C:\Users\SimonOakey\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\gzip.py", line 43, in __call__
    await self.app(scope, receive, self.send_with_gzip)
  File "C:\Users\SimonOakey\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\cors.py", line 84, in __call__
    await self.app(scope, receive, send)
  File "C:\Users\SimonOakey\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\exceptions.py", line 79, in __call__
    raise exc
  File "C:\Users\SimonOakey\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\exceptions.py", line 68, in __call__
    await self.app(scope, receive, sender)
  File "C:\Users\SimonOakey\stable-diffusion-webui\venv\lib\site-packages\fastapi\middleware\asyncexitstack.py", line 21, in __call__
    raise e
  File "C:\Users\SimonOakey\stable-diffusion-webui\venv\lib\site-packages\fastapi\middleware\asyncexitstack.py", line 18, in __call__
    await self.app(scope, receive, send)
  File "C:\Users\SimonOakey\stable-diffusion-webui\venv\lib\site-packages\starlette\routing.py", line 706, in __call__
    await route.handle(scope, receive, send)
  File "C:\Users\SimonOakey\stable-diffusion-webui\venv\lib\site-packages\starlette\routing.py", line 276, in handle
    await self.app(scope, receive, send)
  File "C:\Users\SimonOakey\stable-diffusion-webui\venv\lib\site-packages\starlette\routing.py", line 66, in app
    response = await func(request)
  File "C:\Users\SimonOakey\stable-diffusion-webui\venv\lib\site-packages\fastapi\routing.py", line 235, in app
    raw_response = await run_endpoint_function(
  File "C:\Users\SimonOakey\stable-diffusion-webui\venv\lib\site-packages\fastapi\routing.py", line 163, in run_endpoint_function
    return await run_in_threadpool(dependant.call, **values)
  File "C:\Users\SimonOakey\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 "C:\Users\SimonOakey\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 "C:\Users\SimonOakey\stable-diffusion-webui\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 937, in run_sync_in_worker_thread
    return await future
  File "C:\Users\SimonOakey\stable-diffusion-webui\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 867, in run    result = context.run(func, *args)
  File "C:\Users\SimonOakey\stable-diffusion-webui\modules\api\api.py", line 244, in img2imgapi
    processed = scripts.scripts_img2img.run(p, *p.script_args)
  File "C:\Users\SimonOakey\stable-diffusion-webui\modules\scripts.py", line 376, in run
    processed = script.run(p, *script_args)
TypeError: Script.run() missing 11 required positional arguments: 'save_depthmap', 'treshold', 'match_size', 'net_width', 'net_height', 'invert_depth', 'model_type', 'override_mask_blur', 'override_fill', 'clean_cut', and 'save_alpha_crop'
```


### Additional information

_No response_