save_image: Extract and save image from Gemini API response

View source: R/utils.R

save_imageR Documentation

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)

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.

Value

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

Examples

## Not run: 
save_image(res_txt, "output.png")

## End(Not run)

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