All Products
Search
Document Center

PolarDB:AI_ImageFromBase64

Last Updated:Apr 08, 2025

Converts a Base64-encoded string into binary image data.

Syntax

bytea AI_ImageFromBase64 (text image)

Parameters

Parameter

Description

image

The Base64-encoded string that represents the image data. 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 representation of binary image data).

Note

For more information about MIME types, see the related community documentation.

Return values

Returns the binary image data converted from the Base64 string.

Description

The function supports the following image formats: JPEG, PNG, and BMP.

Example

If you are working with a text embedding model in Qwen LLM that requires image data as input, you can use this function to prepare the image. 

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