Skip to content

Instantly share code, notes, and snippets.

@VioletVivirand
Last active February 13, 2025 08:11
Show Gist options
  • Save VioletVivirand/feb3e129f70a91eb453ab9b6abb3d315 to your computer and use it in GitHub Desktop.
Save VioletVivirand/feb3e129f70a91eb453ab9b6abb3d315 to your computer and use it in GitHub Desktop.
Decode ComfyUI workflow into JSON (Provided by Claude 3.5 Sonnet v2)
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))
# 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