All Products
Search
Document Center

PolarDB:AI_ImageFromBase64

Last Updated:Mar 28, 2026

Converts a Base64-encoded string into binary image data.

Syntax

bytea AI_ImageFromBase64 (text image)

Parameters

ParameterTypeDescription
imagetextThe Base64-encoded image string. The string starts with data:, followed by the Multipurpose Internet Mail Extensions (MIME) type of the image. Example: data:image/jpeg;base64,xxxxx, where xxxxx is the Base64-encoded binary image data. For supported MIME types, see the data URI scheme.

Return value

Returns the binary image data (bytea) converted from the Base64 string.

Supported formats

JPEG, PNG, and BMP.

Example

The following example converts a Base64-encoded JPEG string into binary image data. Use this function to prepare image input for text embedding models such as Qwen LLM.

SELECT AI_ImageFromBase64('data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD...');