ComfyUI Extension: ComfyUI-RWImageS3
A powerful ComfyUI extension that enables seamless integration with AWS S3 storage for reading and saving images directly within your ComfyUI workflows. This extension eliminates the need for manual file transfers by providing direct S3 connectivity for your image processing pipelines.
Custom Nodes (0)
README
ComfyUI S3 Image Nodes
A powerful ComfyUI extension that enables seamless integration with AWS S3 storage for reading and saving images directly within your ComfyUI workflows. This extension eliminates the need for manual file transfers by providing direct S3 connectivity for your image processing pipelines.
šø See It In Action
ComfyUI workflow showing S3 nodes in action
š What This Project Does
This ComfyUI extension provides two custom nodes that enable direct interaction with AWS S3 storage:
- Read images directly from S3 using flexible, user-defined paths
- Save processed images directly to S3 with automatic timestamping
- Custom S3 path input - specify any S3 object key directly in the interface
- Automatic image processing including EXIF orientation correction and format standardization
šø Supported Image Formats
The extension supports the following single-frame image formats:
.png- Portable Network Graphics.jpg/.jpeg- JPEG images.bmp- Bitmap images.webp- WebP images.tiff- Tagged Image File Format
ā ļø Important Note: This extension processes images as RGB only and does not support alpha channels or masks. All images are converted to 3-channel RGB format during processing.
š¦ Installation
1. Clone the Repository
Navigate to your ComfyUI custom nodes directory and clone this repository:
# Navigate to ComfyUI custom nodes directory
cd /ComfyUI/custom_nodes
# Clone the repository
git clone https://github.com/lakkiy/ComfyUI-RWImageS3.git
# Navigate into the project directory
cd ComfyUI-RWImageS3
2. Install Dependencies
Install the required Python packages using pip. If you're using a virtual environment, make sure to activate it first:
# If using virtual environment, activate it first
# source venv/bin/activate # On Linux/Mac
# venv\Scripts\activate # On Windows
# Install dependencies from requirements.txt (recommended)
pip install -r requirements.txt
# Or install manually with specific versions
pip install boto3 numpy pillow python-dotenv torch
3. Configure AWS Credentials
Edit the .env file with your AWS configuration:
# AWS credentials
AWS_ACCESS_KEY_ID=your_access_key_here
AWS_SECRET_ACCESS_KEY=your_secret_key_here
AWS_REGION=us-east-1
S3_BUCKET_NAME=your-bucket-name
4. Set Up S3 Bucket Structure
⨠New in v2.0: Flexible folder structure! You can now organize your images in any folder structure you prefer.
Recommended S3 bucket organization:
your-bucket-name/
āāā images/ # Your source images (any structure)
ā āāā photos/
ā āāā datasets/
ā āāā temp/
āāā output/ # Processed images will be saved here
Note: With the updated ReadImageFromS3 node, you can specify any S3 object key directly in the ComfyUI interface.
5. Restart ComfyUI
Restart ComfyUI to load the new custom nodes. The nodes will appear in the image category.
š§© Available Nodes
1. Read Image From S3
Category: image
Node Name: Read Image From S3
š Updated in v2.0: Now supports custom S3 paths!
This node loads images directly from any location in your S3 bucket into ComfyUI workflows.
Features:
- ⨠Custom S3 path input: Specify any S3 object key directly in the interface
- S3 object validation: Automatically checks if the specified file exists
- EXIF orientation correction: Automatically rotates images based on EXIF data
- Format standardization: Converts all images to RGB format for consistent processing
- Tensor normalization: Outputs properly normalized tensors in [0, 1] range
Inputs:
- s3_key (text): Full S3 object key path (e.g., "photos/vacation/beach.jpg")
Outputs:
- IMAGE: PyTorch tensor of shape
[1, H, W, 3]with RGB values normalized to [0, 1]
Usage:
- Upload images anywhere in your S3 bucket
- Add the "Read Image From S3" node to your workflow
- Enter the full S3 object key in the text field (e.g., "my-folder/image.png")
- Connect the output to other image processing nodes
Example S3 Paths:
photos/2024/vacation.jpgdatasets/training/sample001.pnginput/test.webptemp/processed_image.bmp
2. Save Image To S3
Category: image
Node Name: Save Image To S3
This node saves processed images from ComfyUI workflows directly to your S3 bucket's output folder.
Features:
- Automatic timestamping: Appends timestamp to filenames for uniqueness
- PNG format: Saves images in lossless PNG format
- Pass-through output: Returns the original image tensor for downstream nodes
- S3 key tracking: Provides the S3 location of saved files
- Batch handling: Supports both batched
[1, H, W, 3]and unbatched[H, W, 3]tensors
Inputs:
- image (IMAGE): PyTorch tensor containing the image data to save
- filename_prefix (STRING): Base name for the saved file (default: "output_image")
Outputs:
- IMAGE: The same input tensor (unchanged, for connecting to preview nodes)
- STRING: S3 key of the uploaded file (e.g., "output/prefix_20240604123456.png")
Usage:
- Connect an image tensor from any image processing node
- Set a descriptive filename prefix
- The node will save the image to S3 and return both the image and S3 location
- Connect the image output to PreviewImage or other nodes as needed
š§ Configuration Details
Environment Variables
| Variable | Description | Example |
|----------|-------------|---------|
| AWS_ACCESS_KEY_ID | Your AWS access key ID | AKIAIOSFODNN7EXAMPLE |
| AWS_SECRET_ACCESS_KEY | Your AWS secret access key | wJalrXUtnFEMI/K7MDENG/... |
| AWS_REGION | AWS region for your S3 bucket | us-east-1 |
| S3_BUCKET_NAME | Name of your S3 bucket | my-comfyui-bucket |
S3 Permissions Required
Your AWS credentials need the following S3 permissions:
s3:ListBucket- To list available imagess3:GetObject- To download images from input folders3:PutObject- To upload processed images to output folder
Example IAM policy:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:ListBucket"
],
"Resource": "arn:aws:s3:::your-bucket-name"
},
{
"Effect": "Allow",
"Action": [
"s3:GetObject",
"s3:PutObject"
],
"Resource": "arn:aws:s3:::your-bucket-name/*"
}
]
}
šÆ Example Workflow
Here's a typical workflow using these S3 nodes:
- Upload source images to any folder in your S3 bucket
- Add "Read Image From S3" node and enter the S3 path (e.g., "photos/my-image.jpg")
- Apply image processing nodes (upscaling, filtering, etc.)
- Add "Save Image To S3" node to save the result
- Optional: Connect to PreviewImage to see the result in ComfyUI
- Check your S3
output/folder for the processed images
š What's New in v2.0:
- Flexible S3 paths: No longer restricted to
input/folder - Direct path input: Type any S3 object key directly in the interface
- Better validation: Real-time S3 object existence checking
- Requirements.txt: Pinned dependency versions for stable installation
š Troubleshooting
Common Issues:
"S3 object not found or inaccessible"
- Verify the S3 object key path is correct (e.g., "folder/image.png")
- Check that the image has a supported file extension
- Ensure your AWS credentials have
s3:GetObjectpermission - Verify the file exists in your S3 bucket
"Failed to download from S3"
- Verify your AWS credentials are correct
- Check that your AWS region matches your S3 bucket's region
- Ensure your credentials have
s3:GetObjectpermission
"Failed to upload to S3"
- Verify your credentials have
s3:PutObjectpermission - Check that your S3 bucket exists and is accessible
- Ensure the output folder exists in your bucket
"S3 key cannot be empty" or validation errors
- Make sure to enter a valid S3 object key in the text field
- Verify your
.envconfiguration is correct - Check ComfyUI console for detailed error messages
š Requirements
- ComfyUI (latest version recommended)
- Python 3.8+
- AWS Account with S3 access
- Dependencies: boto3, torch, pillow, python-dotenv, numpy
š¤ Contributing
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
šāāļø Support
If you encounter any issues or have questions, please:
- Check the troubleshooting section above
- Review the ComfyUI console for error messages
- Open an issue on GitHub with detailed information about your problem
Made with ā¤ļø for the ComfyUI community