MediaPipeTasksVision Framework Reference

ImagePart

class ImagePart: TaskPart

Image part representing the image content block of a multi-modal block.

  • Initializes a new MPPImagePart using in-memory image buffer data.

    Declaration

    Swift

    convenience init(data: Data)

    Parameters

    data

    The raw image data bytes.

    Return Value

    An instance of MPPImagePart configured with in-memory data.

  • Initializes a new MPPImagePart using a path or resource handle.

    Declaration

    Swift

    convenience init(filePath: String)

    Parameters

    filePath

    The path or resource handle for the image.

    Return Value

    An instance of MPPImagePart configured with the file path.

  • Initializes a new MPPImagePart with both a resource handle and transient in-memory image data.

    Declaration

    Swift

    init(filePath: String?, data: Data?)

    Parameters

    filePath

    The optional path or resource identifier handle to persist in storage.

    data

    The optional raw image data bytes to use for in-memory embedding.

    Return Value

    An instance of MPPImagePart.

  • The raw in-memory image buffer, if initialized with data. Nil if initialized from a file path alone or deserialized from persistent storage.

    Declaration

    Swift

    var data: Data? { get }
  • The filesystem path or resource identifier handle (e.g., asset URI) for the image. May be provided alongside in-memory data to persist a lightweight handle while embedding from memory.

    Declaration

    Swift

    var filePath: String? { get }