Skip to content

Miscellaneous#

Image Types#

ImageMode #

Supported image modes for Daft's image type.

Warning

Currently, only the 8-bit modes (L, LA, RGB, RGBA) can be stored in a DataFrame. If your binary image data includes other modes, use the mode argument in image.decode to convert the images to a supported mode.

Methods:

Name Description
from_mode_string

Create an ImageMode from its string representation.

Attributes:

Name Type Description
L
L16
LA
LA16
RGB
RGB16
RGB32F
RGBA
RGBA16
RGBA32F

L #

L = 1

L16 #

L16 = 5

LA #

LA = 2

LA16 #

LA16 = 6

RGB #

RGB = 3

RGB16 #

RGB16 = 7

RGB32F #

RGB32F = 9

RGBA #

RGBA = 4

RGBA16 #

RGBA16 = 8

RGBA32F #

RGBA32F = 10

from_mode_string #

from_mode_string(mode: str) -> ImageMode

Create an ImageMode from its string representation.

Parameters:

Name Type Description Default
mode str

String representation of the mode. This is the same as the enum attribute name, e.g. ImageMode.from_mode_string("RGB") would return ImageMode.RGB.

required
Source code in daft/daft/__init__.pyi
68
69
70
71
72
73
74
75
76
77
@staticmethod
def from_mode_string(mode: str) -> ImageMode:
    """Create an ImageMode from its string representation.

    Args:
        mode: String representation of the mode. This is the same as the enum
            attribute name, e.g. ``ImageMode.from_mode_string("RGB")`` would
            return ``ImageMode.RGB``.
    """
    ...

ImageFormat #

Supported image formats for Daft's image I/O.

Methods:

Name Description
from_format_string

Create an ImageFormat from its string representation.

Attributes:

Name Type Description
BMP
GIF
JPEG
PNG
TIFF

BMP #

BMP = 5

GIF #

GIF = 4

JPEG #

JPEG = 2

PNG #

PNG = 1

TIFF #

TIFF = 3

from_format_string #

from_format_string(mode: str) -> ImageFormat

Create an ImageFormat from its string representation.

Source code in daft/daft/__init__.pyi
125
126
127
128
@staticmethod
def from_format_string(mode: str) -> ImageFormat:
    """Create an ImageFormat from its string representation."""
    ...