Skip to main content

Upload Image

Uploads an image from your local file system to Leonardo AI for use as an init image in image-to-image generation.

Common Properties

  • Name - The custom name of the node.
  • Color - The custom color of the node.
  • Delay Before (sec) - Waits in seconds before executing the node.
  • Delay After (sec) - Waits in seconds after executing node.
  • Continue On Error - Automation will continue regardless of any error. The default value is false.

Inputs

  • Connection Id (String) - Connection ID from the Connect node (optional if API Key credentials are provided directly).
  • Image Path (String) - Local file path to the image you want to upload.

Options

  • API Key - Leonardo AI API key (optional if using Connection ID).
  • Image Type - Image file format:
    • png (Default)
    • jpg
    • jpeg
    • webp

Outputs

  • Image Id (String) - ID of the uploaded image. Use this with Create Generation for image-to-image generation.

How It Works

The Upload Image node uploads a local image file to Leonardo AI. When executed, the node:

  1. Validates the image path is not empty
  2. Checks that the file exists at the specified path
  3. Requests upload credentials from Leonardo AI API
  4. Uploads the image file to the provided URL
  5. Returns the image ID for use in generation

Requirements

  • Valid Leonardo AI API key (via Connection ID or credentials)
  • Valid local file path to an image
  • Image file must exist and be readable
  • Supported image format (png, jpg, jpeg, webp)

Error Handling

The node will return specific errors in the following cases:

  • Empty image path - "Image Path cannot be empty. Please provide a valid file path to the image."
  • File not found - "Image file not found at path: {{path}}. Please verify the file exists and the path is correct."
  • Upload initialization failed - "Failed to initialize image upload. API error: {{details}}"
  • Upload failed - "Failed to upload image file. API error: {{details}}"

Usage Examples

Basic Image Upload

Upload an image for image-to-image generation:

  1. Specify the local path: /path/to/image.png
  2. Select image type: png
  3. Run the node to get the image ID
  4. Use the image ID in Create Generation node

Upload and Transform

Transform an existing image:

  1. Upload Image: /downloads/photo.jpg
  2. Get the image ID from output
  3. Create Generation:
    • Prompt: "Turn this into a cartoon style illustration"
    • Image Id: Use the uploaded image ID
    • Init Strength: 0.6

Batch Upload Images

Upload multiple images in a loop:

const imagePaths = [
'/images/photo1.png',
'/images/photo2.png',
'/images/photo3.png'
];

const imageIds = [];

// Loop through paths and upload each
// Store resulting image IDs in array

Upload Screenshot

Upload a screenshot for processing:

  1. Take Screenshot node: Save to /tmp/screen.png
  2. Upload Image: /tmp/screen.png, type: png
  3. Use returned image ID for generation

Usage Notes

  • The image path must be an absolute path to a file on your local system
  • Uploaded images are stored temporarily in Leonardo AI for use in generations
  • The returned image ID can be used multiple times in different generations
  • Ensure the image type matches your actual file format
  • Large images may take longer to upload
  • Uploaded images count against your storage quota
  • Use Get Image to retrieve upload details
  • Use Delete Image to remove uploaded images and free up storage
  • The image must be accessible by the robot executing the flow
  • Common use cases: image-to-image generation, style transfer, image enhancement