Skip to main content
Vane Data / Reference

image_to_tensor

image_to_tensor converts IMAGE pixels into an HWC TENSOR without changing pixel values. Known modes preserve UInt8, UInt16, or Float32; a generic IMAGE uses Float32.

Signature

example.py
vane.image_to_tensor(image) -> Expression

SQL: image_to_tensor(image). Expression method: expr.image_to_tensor().

Parameters

NameTypeDescriptionDefault
imageIMAGE value or ExpressionInput imageRequired

Returns and errors

Returns a TENSOR with shape (height, width, channels). image_to_tensor belongs to the base engine and needs no image backend, regardless of image_backend. NULL returns NULL.

Example

example.py
import vane


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