ComfyUI Node: Image Prep

Class Name

ImagePrep

Category
🚦ComfyUI_LLMs_Toolkit/Image
Author
HuangYuChuh (Account age: 42days)
Extension
ComfyUI-LLMs-Toolkit
Latest Updated
2026-04-23
Github Stars
0.02K

How to Install ComfyUI-LLMs-Toolkit

Install this extension via the ComfyUI Manager by searching for ComfyUI-LLMs-Toolkit
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter ComfyUI-LLMs-Toolkit in the search bar
After installation, click the Restart button to restart ComfyUI. Then, manually refresh your browser to clear the cache and access the updated list of nodes.

Visit ComfyUI Online for ready-to-use ComfyUI environment

  • Free trial available
  • 16GB VRAM to 80GB VRAM GPU machines
  • 400+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 200+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

Image Prep Description

Preprocess images for LLM vision inputs, convert to base64 data-URIs, support `torch.Tensor` and `PIL.Image`, process up to eight images at a time.

Image Prep:

The ImagePrep node is designed to preprocess images for use in Large Language Model (LLM) vision inputs by converting them into base64 data-URIs. This node is particularly useful for preparing images to be embedded directly into text-based data streams, allowing for seamless integration of visual content into applications that utilize LLMs. By supporting both torch.Tensor and PIL.Image formats, ImagePrep offers flexibility in handling different image data types. The node can process up to eight images at a time, encoding them into a format that is easily transferable and compatible with web-based applications. This capability is essential for AI artists and developers who need to incorporate visual data into their LLM workflows efficiently.

Image Prep Input Parameters:

image

This parameter represents the primary image to be processed. It can be either a torch.Tensor or a PIL.Image. The image is converted into a base64 data-URI, which is a text representation of the image that can be easily embedded into HTML or JSON. The quality of the encoding can be adjusted based on the format and quality settings.

format

The format parameter specifies the desired output format for the image encoding. Common options include "PNG", "JPEG", and "WebP". The choice of format affects the compression and quality of the resulting image data-URI. For instance, "JPEG" and "WebP" formats allow for quality adjustments, which can impact the file size and visual fidelity of the image.

quality

This parameter determines the quality level of the image encoding when using formats that support quality adjustments, such as "JPEG" and "WebP". The options are "High", "Medium", and "Low", corresponding to quality values of 95, 75, and 50, respectively. Higher quality settings result in larger file sizes but better image fidelity, while lower settings reduce file size at the cost of image quality.

Image Prep Output Parameters:

urls

The output is a JSON-encoded list of base64 data-URIs representing the processed images. Each URI is a text string that encodes the image data, allowing it to be easily embedded in web pages or transmitted over networks. This output is crucial for integrating visual content into applications that require image data in a text-compatible format.

Image Prep Usage Tips:

  • To optimize image quality and file size, choose the appropriate format and quality settings based on your specific needs. For web applications, "WebP" with medium quality can offer a good balance between size and quality.
  • When processing multiple images, ensure that all images are either torch.Tensor or PIL.Image to avoid compatibility issues.

Image Prep Common Errors and Solutions:

Unsupported image type. Expected torch.Tensor or PIL.Image.

  • Explanation: This error occurs when the input image is neither a torch.Tensor nor a PIL.Image.
  • Solution: Ensure that the input image is converted to one of the supported formats before passing it to the node.

At least one image input must be provided.

  • Explanation: This error is raised when no images are provided for processing.
  • Solution: Provide at least one valid image input to the node to proceed with the encoding process.

Image Prep Related Nodes

Go back to the extension to check out more related nodes.
ComfyUI-LLMs-Toolkit
RunComfy
Copyright 2025 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals. RunComfy also provides AI Models, enabling artists to harness the latest AI tools to create incredible art.

Image Prep