Class ImageLoader

java.lang.Object
dev.langchain4j.image_to_diagram.ImageLoader

public class ImageLoader extends Object
The `ImageLoader` class provides utility methods for loading and converting images to Base64 format.
  • Constructor Details

    • ImageLoader

      public ImageLoader()
  • Method Details

    • loadImageAsBase64

      public static String loadImageAsBase64(String resourcePath) throws IOException
      Loads an image from a resource path as a Base64 encoded string.
      Parameters:
      resourcePath - the path of the image resource
      Returns:
      the Base64 encoded string representing the image
      Throws:
      IOException - if an I/O error occurs while reading the input stream
    • loadImageAsBase64

      public static String loadImageAsBase64(InputStream inputStream) throws IOException
      Loads an image from an input stream and returns its Base64 encoded string representation.
      Parameters:
      inputStream - the input stream containing the image data
      Returns:
      the Base64 encoded string representing the image
      Throws:
      IOException - if an I/O error occurs while reading the input stream