Skip to main content
For the complete documentation index for agents and LLMs, see llms.txt.

DeepsetFileToBase64Image

Convert image files from disk into base64-encoded images for use in visual question answering pipelines.

Deprecation Notice

This component is deprecated. Use ImageFileToImageContent from Haystack instead. Existing pipelines that use this component continue to work for now.

Key Features

  • Reads image files from local disk and converts them to Base64Image objects.
  • Supports PNG, JPG, JPEG, and GIF file formats.
  • Accepts documents with file_path metadata or direct file sources.
  • Configurable image detail level for vision model input sizing.

Configuration

  1. Drag the DeepsetFileToBase64Image component onto the canvas from the Component Library.
  2. Click the component to open the configuration panel.
  3. Set detail to control how the image is resized before encoding.

Connections

DeepsetFileToBase64Image accepts documents with file_path metadata or direct sources as input. It outputs documents and base64_images.

Connect DeepsetFileDownloader to provide documents with local file paths. Connect the base64_images output to a visual Generator such as DeepsetOpenAIVisionGenerator or Base64ImageJoiner.

Usage Example

This example converts downloaded image files to base64 for a vision Generator:

components:
image_downloader:
type: deepset_cloud_custom_nodes.augmenters.deepset_file_downloader.DeepsetFileDownloader
init_parameters:
file_extensions:
- .png
- .jpg
- .jpeg
sources_target_type: str
max_cache_size: 100

file_to_image:
type: deepset_cloud_custom_nodes.converters.file_to_image.DeepsetFileToBase64Image
init_parameters:
detail: auto

connections:
- sender: image_downloader.documents
receiver: file_to_image.documents

Parameters

Inputs

ParameterTypeDefaultDescription
documentsOptional[List[Document]]NoneDocuments with file_path in metadata pointing to image files.
sourcesOptional[List[Union[str, Path, ByteStream]]]NoneDirect file paths or byte streams to convert.

Outputs

ParameterTypeDefaultDescription
documentsList[Document]Documents that had convertible image files.
base64_imagesList[Base64Image]Base64-encoded images ready for vision Generators.

Init Parameters

These are the parameters you can configure in Pipeline Builder:

ParameterTypeDefaultDescription
detailLiteral["auto", "low", "high"]autoControls how the image is resized before encoding. See the OpenAI vision documentation for details.

Run Method Parameters

These are the parameters you can configure for the component's run() method. This means you can pass these parameters at query time through the API, in Playground, or when running a job. For details, see Modify Pipeline Parameters at Query Time.

ParameterTypeDefaultDescription
documentsOptional[List[Document]]NoneDocuments with file_path in metadata.
sourcesOptional[List[Union[str, Path, ByteStream]]]NoneDirect file paths or byte streams to convert.