Comfy-Org / Comfy-Org/ComfyUI_frontend

[Feature Request]: Support for compressed workflows (in particular embedded in files)

Open
#1,468 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
TypeScript
Stars
2k
Forks
699
Avg merge
1d 7h
Merged PRs (30d)
490

Description

### Is there an existing issue for this?

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

### What would your feature do ?

Embedding the workflow and "prompt" (quite misleading name IMHO) in files is really nice, but ... some people likes to propose/use _all-in-one_ workflows which are really heavy. I recently came up with one that is 500 kB long.

Embedding a 500 kB workflow in a 1 MB PNG doesn't have much sense to me.

So I propose to save the data compressed. Perhaps optional for compatibility.

I think the decompression should be done by the JavaScript code (is that correct?), but a quick search indicates that gzip format is implemented. If the server side could do the job then you could use a variety of formats, even just store the name of the tool. The *gzip*, *bzip2* and *lzma* command are interchangeable. Doing it on the server side is really simple, you detect which compressor is available (you start detecting the stronger first) and call it, no need for Python support, just call an external tool. If none is available you return the uncompressed text. To uncompress if the tool is missing you return some error explaining which compressor to install in the server.

This can be extended easily, if the name of the compressor is at the beginning of the data you can use new compressors, just adding them at the server side.

JSON files are reduced drastically using compression.

Older data starts with `{` and you know they are plain JSON, new data could be something like: `lzma:COMPRESSED_STREAM`

### Proposed workflow

1. When saving a file with workflow the data gets compressed
2. When loading an image if the data is not JSON the data is sent to the server and it returns the uncompressed stream

### Additional information

I could even try to implement it if this is something desirable

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.