Comfy-Org / Comfy-Org/ComfyUI_frontend
[Feature Request]: Allow ComfyUI to load a zipped workflow. That could save us up to 90% of storage on each image saved with workflow embedded
- 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 ?
I'm not completely sure, but I think this suggestion should be made here on the UI_frontend and not on the comfyui main repo as I did, if so, I would close that opened issue there: https://github.com/comfyanonymous/ComfyUI/issues/6808
Feature Idea
Right now, I need to choose:
1- not to save an image with workflow embedded, or
2- dumb down my workflows and save the image with embedded workflow
That is because the image, even when saving with a compressed WebP, would still be 1-2mb each, given that the big workflows me and a lot of people like to make can get gigantic.
I purpose to allow ComfyUI to be able to open a zipped or 7z file with a comfy json on it. With that, we could store the workflow on the image, zipped, saving up to 90% of storage.
For example, one of my workflow have 1.68MB. By zipping it with windows standard zip it becomes 180kb. By using 7zip with the "ultra" compression, it gets to 99 kbs only.
It makes totally sense to store a workflow so you can reproduce your image again. But that starts to make no sense when you are storing a 1.5MB of avoidable extra data multiplied by 1,000 images.
I'm not sure if this could open to some security issues, but I don't think so.
And according to ChatGPT it is possible (but it tends to lie):
```
Theoretical Answer: Yes, You Can Store a Zipped Workflow
You can store any binary data (including a compressed ZIP of the workflow JSON) inside PNG and WEBP metadata, just like you store the uncompressed JSON.
How Would It Work?
Compress the JSON Workflow
Convert the workflow JSON to a string.
Compress it using zlib or gzip.
Encode the compressed data in Base64 (since metadata fields expect text).
Embed the Compressed Workflow in the Image
Store the Base64-encoded compressed workflow in the EXIF metadata (WEBP) or PNG info (PNG).
Read and Decompress It Later
When loading the image, extract the Base64-encoded string from metadata.
Decode it from Base64.
Decompress it back into the original JSON.
```
### Proposed workflow
1. Drag and drop a zipped .zip or .7z json workflow on comfyui screen
2. ComfyUI decompress and reads the .json workflow
3. ALso drag and drop a webp or png image with a .zip or .7zip workflow embedded on comfyui screen
4. ComfyUI reads the embedded metadata as a compressed workflow, decompress it and load the workflow
### Additional information
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.