Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upscale issue #3: can’t upscale images beyond 8K-10k size #1265

Open
valery016 opened this issue Oct 15, 2024 · 6 comments
Open

Upscale issue #3: can’t upscale images beyond 8K-10k size #1265

valery016 opened this issue Oct 15, 2024 · 6 comments

Comments

@valery016
Copy link

Issue #3 (an old one too) : can’t upscale images beyond 8K-10k size

Upscaling beyond 8-10K sizes with the Krita AI plugin seems unattainable: when 2x upscaling a file of that size, Krita will be fine with taking it to 16K, but the plugin always returns a failure in red, see below.

upscale screenshot 2 (issue #3)

Is this a ComfyUI problem? I have quite a capable PC with RTX 4070 Ti Super card (16 GB) and when using Forge, I routinely process images of up to 64K size, upscaling from 8K or 10K resolution never posed a problem. What is also strange, I can easily load a 32K image into Krita and inpaint or generate with the plugin various (not too large) selections in it, no problem whatsoever.

@valery016 valery016 changed the title Issue #3: can’t upscale images beyond 8K-10k size Upscale issue #3: can’t upscale images beyond 8K-10k size Oct 15, 2024
@megagrump
Copy link

Try starting ComfyUI with --max-upload-size 200 or more to override the default limit of 100 (megabytes).

@valery016
Copy link
Author

valery016 commented Oct 16, 2024

Thanks megagrump, I didn't know about this switch. Setting it to some very large value and restarting Comfy didn't change much though: when attempting to 2x upscale a 7200x9600 image, I get a somewhat different failure message in red:

upscale screenshot 3 (issue #3)

(while Krita upscales the image to the target size with no issues whatsoever. Note also the bizarre target size indicator).

The original message, however, concerned Krita AI-managed server, not an external one. In that case, this parameter is controlled, I understand, by the Maximum Pixel Count setting in Performance. I set it to 99 MP, the maximum allowed value, but the plugin still returns the same failure in red letters when 2x upscaling that image. In any case, the plugin's 100 MP limit translates to a picture of roughly 12Kx8K dimensions, which is nowadays nothing unusual (especially for AI-assisted image processing), I don't understand why such restriction in the first place.

@valery016
Copy link
Author

UPDATE. I receive the message “Error Failed to read JSON 'Maximum request body size 104857600 exceeded, actual body size 104861476' with message: Unexpected character encountered while parsing value: M. Path '', line 0, position 0.” in SwarmUI when trying to refine a 6144x8192 image, both in non-tiled and HyperTiled Refine/Upscale mode. In general, processing of files starting from 6-8K resolution seems impossible in SwarmUI. This problem may or may be of the same nature as the failure to upscale or refine high resolution files with the Krita AI plugin. If the underlying motivation for this 104857600 restriction is the Comfy’s reliance on the ancient ImageBase64 encoding in the JSON workflow file (which makes them swell beyond reason), then it’s not a very clever part of its methodology and needs to be upgraded a.s.a.p.

@Acly
Copy link
Owner

Acly commented Oct 18, 2024

that's probably the reason, there was no such limit in the past I think (or I never hit 100mb png dispite using larger resolutions, it depends on the content too)

also, it was me who introduced base64 transfer, it's convenient

@megagrump
Copy link

it's convenient

It also reduces the maximum image transfer size by 33% with the current implementation. The mere existence of such a cap in an upscale workflow is unfortunate. The inefficient encoding exacerbates the issue on top of the (arbitrary?) limit, and slows down the entire process, especially when working remotely over a network.

@Acly
Copy link
Owner

Acly commented Oct 18, 2024

Yea it was made for local prompts without a maximum request limit. The content type must be JSON, base64 is pretty much the only option to embed images directly.

ComfyUI's "native" way of doing it is separate upload requests that write to the filesystem, I don't particularly like it because files need to be cleaned up and have a host of issues.

Cloud client already uses separate uploads/downloads, so it's not difficult from plugin side, but might need a custom node.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants