Vane Data / Reference
Image accessors
image_width, image_height, image_channel, image_mode, and image_attribute read IMAGE metadata without decoding pixels or opening files. They belong to the base engine, return UINTEGER, and are not affected by image_backend.
Signature
vane.image_width(image) -> Expression vane.image_height(image) -> Expression vane.image_channel(image) -> Expression vane.image_mode(image) -> Expression vane.image_attribute(image, name) -> Expression
SQL: image_width(image), image_height(image), image_channel(image), image_mode(image), and image_attribute(image, name). All five have Expression methods.
Parameters
| Function | Returns |
|---|---|
| image_width(image) | Width in pixels |
| image_height(image) | Height in pixels |
| image_channel(image) | Channel count |
| image_mode(image) | Numeric mode code (see below) |
| image_attribute(image, name) | Property named by name: height, width, channel, or mode |
image_mode returns the mode code, which follows the mode order and covers all ten modes:
| Mode | Code | Channels | Pixel dtype |
|---|---|---|---|
| L | 1 | 1 | UInt8 |
| LA | 2 | 2 | UInt8 |
| RGB | 3 | 3 | UInt8 |
| RGBA | 4 | 4 | UInt8 |
| L16 | 5 | 1 | UInt16 |
| LA16 | 6 | 2 | UInt16 |
| RGB16 | 7 | 3 | UInt16 |
| RGBA16 | 8 | 4 | UInt16 |
| RGB32F | 9 | 3 | Float32 |
| RGBA32F | 10 | 4 | Float32 |
Returns and errors
Each accessor returns UINTEGER; NULL inputs return NULL. image_attribute raises for an unknown property name.
Example
import vane con = vane.connect() con.sql(""" SELECT image_width(image) AS width, image_height(image) AS height, image_channel(image) AS channels, image_mode(image) AS mode FROM (SELECT decode_image_file(image_file('photo.png')) AS image) """).show()