read_image: Read and encode image file as base64

View source: R/utils.R

read_imageR Documentation

Read and encode image file as base64

Description

Reads an image file from the given path and encodes it as a base64 string. Used internally for Gemini API image upload.

Usage

read_image(img_path)

Arguments

img_path

Path to the image file.

Value

Base64-encoded string of the image, or NULL if the file does not exist.

Examples

## Not run: 
base64_img <- read_image("cat.png")

## End(Not run)

gemini.R documentation built on Sept. 1, 2025, 5:10 p.m.