Skip to content

daft.functions.image_file#

image_file #

image_file(url: Expression, verify: bool = False, io_config: IOConfig | None = None) -> Expression

Converts a string containing a file reference to a daft.ImageFile reference.

Parameters:

Name Type Description Default
url String Expression

the url of the file

required
verify bool

If True, verify that the file exists and is an image file. If ANY files are not images, this will produce an error.

False
io_config IOConfig, default=None

The IO configuration to use.

None

Returns:

Name Type Description
Expression File[Image] Expression

An expression containing the file reference.

Source code in daft/functions/file_.py
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
def image_file(url: Expression, verify: bool = False, io_config: IOConfig | None = None) -> Expression:
    """Converts a string containing a file reference to a `daft.ImageFile` reference.

    Args:
        url (String Expression): the url of the file
        verify:
            If True, verify that the file exists and is an image file.
            If **ANY** files are not images, this will produce an error.

        io_config (IOConfig, default=None): The IO configuration to use.

    Returns:
        Expression (File[Image] Expression): An expression containing the file reference.

    """
    return url._eval_expressions("image_file", verify=verify, io_config=io_config)