Learn R Programming

gemini.R (version 0.17.2)

save_image: Extract and save image from Gemini API response

Description

Extracts base64-encoded image data from the Gemini API response text and saves it as a binary image file.

Usage

save_image(res_txt, output_path)

Value

The path to the saved image file, or NULL if no image data was found.

Arguments

res_txt

Character string. The raw response text from the Gemini API.

output_path

Character string. The file path to save the decoded image.

Examples

Run this code
if (FALSE) {
save_image(res_txt, "output.png")
}

Run the code above in your browser using DataLab