Skip to content

daft.functions.image_file_metadata#

image_file_metadata #

image_file_metadata(file_expr: Expression) -> Expression

Extract image metadata (width, height, format, mode) from a File column.

Parameters:

Name Type Description Default
file_expr File Expression

The file expression to extract metadata from.

required

Returns:

Name Type Description
Expression Struct Expression

A struct containing: - width: uint32 - Image width in pixels - height: uint32 - Image height in pixels - format: str - Image format (e.g. "png", "jpeg") - mode: str - Image mode (e.g. "RGB", "RGBA", "L")

Source code in daft/functions/image_file_.py
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
def image_file_metadata(
    file_expr: Expression,
) -> Expression:
    """Extract image metadata (width, height, format, mode) from a File column.

    Args:
        file_expr (File Expression): The file expression to extract metadata from.

    Returns:
        Expression (Struct Expression): A struct containing:
            - width: uint32 - Image width in pixels
            - height: uint32 - Image height in pixels
            - format: str - Image format (e.g. "png", "jpeg")
            - mode: str - Image mode (e.g. "RGB", "RGBA", "L")
    """
    from daft.expressions import Expression

    return Expression._call_builtin_scalar_fn("image_file_metadata", file_expr)