Last active
February 13, 2025 08:11
-
-
Save VioletVivirand/feb3e129f70a91eb453ab9b6abb3d315 to your computer and use it in GitHub Desktop.
Decode ComfyUI workflow into JSON (Provided by Claude 3.5 Sonnet v2)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PIL import Image | |
import json | |
def extract_workflow_from_png(image_path): | |
with Image.open(image_path) as img: | |
# Get all text chunks | |
for chunk in img.text.items(): | |
if chunk[0] == "workflow": | |
# Parse the JSON data | |
workflow_data = json.loads(chunk[1]) | |
return workflow_data | |
return None | |
# Usage | |
workflow = extract_workflow_from_png("your_workflow.png") | |
print(json.dumps(workflow, indent=2)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# brew install exiftool | |
exiftool -workflow "your_workflow.png" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment