[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

by ADMIN 143 views

[Feature Request]: Allow ComfyUI to Load a Zipped Workflow and Save Storage Space

As a user of ComfyUI, you may have encountered the issue of having to choose between saving an image with a workflow embedded or not, due to the large storage space required for the embedded workflow. This can be a significant problem, especially when working with large workflows and multiple images. In this feature request, we propose allowing ComfyUI to load a zipped workflow, which could save up to 90% of storage space on each image saved with a workflow embedded.

Currently, when saving an image with a workflow embedded, the image file size can be significantly large, even when using compressed formats like WebP. This is because the workflow is stored in its original, uncompressed form, which can take up a lot of space. For example, a workflow with a size of 1.68MB can be compressed to 180KB using a standard zip and to 99KB using 7zip with ultra compression. This means that storing a workflow in its original form can result in a significant amount of avoidable extra data, especially when working with multiple images.

To address this issue, we propose allowing ComfyUI to load a zipped workflow. This would involve the following steps:

  1. Compress the JSON Workflow: The workflow JSON would be converted to a string, compressed using zlib or gzip, and then encoded in Base64.
  2. Embed the Compressed Workflow in the Image: The Base64-encoded compressed workflow would be stored in the EXIF metadata (WEBP) or PNG info (PNG).
  3. Read and Decompress It Later: When loading the image, the Base64-encoded string would be extracted from metadata, decoded from Base64, and decompressed back into the original JSON.

To implement this feature, we propose the following workflow:

  1. Drag and Drop a Zipped .zip or .7z JSON Workflow: A user would be able to drag and drop a zipped .zip or .7z JSON workflow onto the ComfyUI screen.
  2. ComfyUI Decompresses and Reads the .json Workflow: ComfyUI would decompress and read the .json workflow from the zipped file.
  3. Drag and Drop a WebP or PNG Image with a .zip or .7zip Workflow Embedded: A user would be able to drag and drop a WebP or PNG image with a .zip or .7zip workflow embedded onto the ComfyUI screen.
  4. ComfyUI Reads the Embedded Metadata as a Compressed Workflow: ComfyUI would read the embedded metadata as a compressed workflow, decompress it, and load the workflow.

Allowing ComfyUI to load a zipped workflow would have several benefits, including:

  • Reduced Storage Space: By storing the workflow in a compressed form, we can save up to 90% of storage space on each image saved with a workflow embedded.
  • Improved Performance: With reduced storage space, images would load faster, and workflows would be more efficient to work with.
  • Enhanced User Experience: By providing a more efficient and streamlined workflow, users would be able to work more effectively and efficiently.

While there may be some security considerations to take into account when storing compressed workflows, we believe that the benefits of this feature outweigh any potential risks. By using a secure compression algorithm and storing the compressed workflow in a secure location, we can minimize any potential security risks.

In conclusion, allowing ComfyUI to load a zipped workflow would be a significant improvement to the user experience and would provide several benefits, including reduced storage space, improved performance, and an enhanced user experience. We believe that this feature is worth implementing and would like to propose it for consideration.
[Feature Request]: Allow ComfyUI to Load a Zipped Workflow and Save Storage Space - Q&A

In our previous article, we proposed allowing ComfyUI to load a zipped workflow, which could save up to 90% of storage space on each image saved with a workflow embedded. In this article, we will answer some frequently asked questions (FAQs) about this feature request.

A: The purpose of this feature request is to allow ComfyUI to load a zipped workflow, which would save up to 90% of storage space on each image saved with a workflow embedded. This would improve the user experience by reducing storage space, improving performance, and enhancing the overall efficiency of the workflow.

A: The feature would work by compressing the workflow JSON using a secure compression algorithm, such as zlib or gzip. The compressed workflow would then be encoded in Base64 and stored in the EXIF metadata (WEBP) or PNG info (PNG). When loading the image, the compressed workflow would be extracted from metadata, decoded from Base64, and decompressed back into the original JSON.

A: The benefits of this feature include:

  • Reduced Storage Space: By storing the workflow in a compressed form, we can save up to 90% of storage space on each image saved with a workflow embedded.
  • Improved Performance: With reduced storage space, images would load faster, and workflows would be more efficient to work with.
  • Enhanced User Experience: By providing a more efficient and streamlined workflow, users would be able to work more effectively and efficiently.

A: While there may be some security considerations to take into account when storing compressed workflows, we believe that the benefits of this feature outweigh any potential risks. By using a secure compression algorithm and storing the compressed workflow in a secure location, we can minimize any potential security risks.

A: The feature would be implemented by modifying the ComfyUI code to support the loading of zipped workflows. This would involve adding a new feature to the ComfyUI interface that allows users to drag and drop a zipped workflow onto the screen. The ComfyUI code would then decompress and read the workflow from the zipped file.

A: The technical requirements for this feature include:

  • Compressed Workflow Algorithm: A secure compression algorithm, such as zlib or gzip, would be required to compress the workflow JSON.
  • Base64 Encoding: The compressed workflow would need to be encoded in Base64 to store it in the EXIF metadata (WEBP) or PNG info (PNG).
  • Decompression Algorithm: A decompression algorithm would be required to decompress the compressed workflow back into the original JSON.

A: The feature would be tested by creating a zipped workflow and loading it into ComfyUI. The compressed workflow would then be extracted from metadata, decoded from Base64, and decompressed back into the original JSON. The resulting workflow would be compared to the original workflow to ensure that it is identical.

In conclusion, allowing ComfyUI to load a zipped workflow would be a significant improvement to the user experience and would provide several benefits, including reduced storage space, improved performance, and an enhanced user experience. We believe that this feature is worth implementing and would like to propose it for consideration.