class ImageUtils {

    private static final List<String> SUPPORTED_URL_SCHEMES = Arrays.asList("http", "https", "file");

    static List<String> base64EncodeImageList(List<ImageContent> contentList) {
        return contentList.stream()
                .map(ImageContent::image)
                .map(ImageUtils::base64Image)
                .collect(Collectors.toList());
    }

    static String base64Image(Image image) {<FILL_FUNCTION_BODY>}

    private static String httpScheme(Image image) {
        byte[] imageBytes = Utils.readBytes(image.url().toString());
        return Base64.getEncoder().encodeToString(imageBytes);
    }

    private static String fileScheme(Image image) {
        byte[] fileBytes = readAllBytes(Paths.get(image.url()));
        return Base64.getEncoder().encodeToString(fileBytes);

    }

    private static byte[] readAllBytes(Path path) {
        try {
            return Files.readAllBytes(path);
        } catch (IOException e) {
            throw new RuntimeException("cant read file", e);
        }
    }
}


        if (image.base64Data() != null && !image.base64Data().isEmpty()) {
            return image.base64Data();
        } else {
            if (SUPPORTED_URL_SCHEMES.contains(image.url().getScheme())) {
                return image.url().getScheme().startsWith("http") ? httpScheme(image) : fileScheme(image);
            } else {
                throw new RuntimeException("ollama integration only supports http/https and file urls. unsupported url scheme: " + image.url().getScheme());
            }
        }
    
<no_super_class>