Skip to main content
Vane Data / Reference

convert_image

convert_image changes an IMAGE pixel mode and depth without resizing. Alpha is preserved, added as fully opaque, or dropped without compositing. Known target modes preserve fixed input dimensions; per-row modes return a dynamic image.

Signature

example.py
vane.convert_image(image, mode) -> Expression

SQL: convert_image(image, mode). Expression method: expr.convert_image(mode).

Parameters

NameTypeDescriptionDefault
imageIMAGE value or ExpressionInput imageRequired
modeMode name, ImageMode, Expression, or NoneTarget pixel mode; None returns NULLRequired

Returns and errors

Returns an IMAGE. NULL image or mode returns NULL. Unsupported modes raise.

Example

example.py
import vane


con = vane.connect()
con.sql("SELECT convert_image(decode_image_file(image_file('photo.png')), 'RGBA')").show()