Skip to content

daft.functions.image_height#

image_height #

image_height(image: Expression) -> Expression

Gets the height of an image in pixels.

Parameters:

Name Type Description Default
image Image Expression

image to retrieve the height from.

required

Returns:

Name Type Description
Expression UInt32 Expression

An Expression representing the height of the image.

Example

import daft from daft.functions import image_height

Create a dataframe with an image column#

df = ... # doctest: +SKIP df = df.with_column("height", image_height(df["images"])) # doctest: +SKIP

Source code in daft/functions/image.py
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
def image_height(image: Expression) -> Expression:
    """Gets the height of an image in pixels.

    Args:
        image (Image Expression): image to retrieve the height from.

    Returns:
        Expression (UInt32 Expression): An Expression representing the height of the image.

    Example:
        >>> import daft
        >>> from daft.functions import image_height
        >>> # Create a dataframe with an image column
        >>> df = ...  # doctest: +SKIP
        >>> df = df.with_column("height", image_height(df["images"]))  # doctest: +SKIP
    """
    return image_attribute(image, "height")