Transform your ComfyUI workflow collection from storage-hungry PNGs to efficient JPGs while preserving all your precious workflow metadata.
If you're a ComfyUI user, you know the pain:
- Massive PNG files eating up your storage (often 10-50MB+ each)
- Hundreds of nearly-identical workflow JSONs cluttering your folders
- Can't share images on social media without losing embedded workflows
- Storage costs mounting up as your collection grows
This tool solves all of these problems in one intelligent batch operation.
- Converts PNG → JPG with customizable quality settings
- Extracts ComfyUI workflows to separate JSON files
- Smart deduplication - only saves unique workflows (ignores seed changes)
- Preserves workflow functionality - drag & drop JSON files back into ComfyUI
- Batch processes entire directory trees recursively
- Reports space savings so you can see the impact
- Cleans up macOS junk files (optional)
Typical space savings:
- PNG with workflow: 25-50MB per image
- JPG + JSON: 2-5MB per image
- Space reduction: 80-90% smaller files
- 1000 images: Save 20-45GB of storage
- Python 3.6+
- ImageMagick (for JPG conversion)
macOS (Homebrew):
brew install imagemagick
Ubuntu/Debian:
sudo apt-get install imagemagick
Windows: Download from ImageMagick.org
pip install -r requirements.txt
Convert all PNGs in a directory:
python convert_png_jpg_json.py /path/to/your/comfyui/outputs
Convert with custom quality and delete originals:
python convert_png_jpg_json.py /path/to/outputs -q 95 -d
python convert_png_jpg_json.py <source_directory> [options]
Option | Description | Default |
---|---|---|
-q, --quality |
JPEG quality (0-100) | 85 |
-d, --delete-original |
Delete original PNG files | False |
-m, --clean-mac-files |
Remove macOS ._ junk files |
False |
-v, --verbose |
Detailed output for each file | False |
-s, --silent |
Suppress progress output | False |
--inspect <file> |
Debug PNG metadata structure | - |
High quality conversion:
python convert_png_jpg_json.py ./outputs -q 95
Space-saving mode (delete originals):
python convert_png_jpg_json.py ./outputs -d
Clean up everything:
python convert_png_jpg_json.py ./outputs -d -m -q 90
Verbose debugging:
python convert_png_jpg_json.py ./outputs -v
Inspect a specific file:
python convert_png_jpg_json.py --inspect ./outputs/ComfyUI_12345_.png
The tool intelligently compares workflows and only creates JSON files when there are meaningful changes:
✅ Creates JSON for:
- New node configurations
- Different parameters
- Changed connections
- Modified prompts
❌ Skips JSON for:
- Only seed value changes
- Identical workflows with different random seeds
- Control setting changes (randomize/fixed)
Before:
outputs/
├── ComfyUI_12345_.png (45MB, workflow embedded)
├── ComfyUI_12346_.png (44MB, same workflow, different seed)
└── ComfyUI_12347_.png (46MB, new workflow)
After:
outputs/
├── ComfyUI_12345_.jpg (3MB)
├── ComfyUI_12345_.json (workflow data)
├── ComfyUI_12346_.jpg (3MB)
└── ComfyUI_12347_.jpg (3MB)
└── ComfyUI_12347_.json (new workflow data)
Your workflows remain fully functional:
- Drag & drop JSON files into ComfyUI to load workflows
- All node connections and parameters preserved
- Compatible with ComfyUI's native format
- No data loss - everything is preserved
Starting conversion in 'outputs' (Quality: 85%, Delete Original: False, Clean Mac Files: False)...
--------------------------------------------------
ComfyUI_12485_.png: JPG created, JSON created
ComfyUI_12486_.png: JPG created
ComfyUI_12487_.png: JPG created
ComfyUI_12488_.png: JPG created
...
ComfyUI_12491_.png: JPG created, JSON created
ComfyUI_12492_.png: JPG created
--------------------------------------------------
Conversion Summary:
Converted: 28 files
JSON files created: 4 files
Skipped: 0 files (JPG already existed)
Errors: 0 files
Total Space Saved: 1.2 GB
Conversion complete.
"convert command not found"
- Install ImageMagick (see installation section)
- Make sure it's in your PATH
"Could not identify image format"
- File may be corrupted or not a valid PNG
- Use
--inspect
to debug the file
"No workflow metadata found"
- PNG wasn't generated by ComfyUI
- Or workflow embedding was disabled in ComfyUI
Permission errors
- Check file/directory permissions
- Run with appropriate user privileges
- ComfyUI power users with large image collections
- AI artists sharing work on social media
- Workflow collectors organizing and archiving
- Storage-conscious users managing disk space
- Teams sharing workflows without massive files
Found a bug? Have a feature request? Contributions welcome!
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
MIT License - feel free to use and modify as needed.
If this tool saved you storage space and headaches, consider:
- ⭐ Starring the repository
- 🐛 Reporting issues
- 💡 Suggesting improvements
- 📢 Sharing with the ComfyUI community
Transform your ComfyUI workflow collection today - your storage drive will thank you!