ImagePart
data class ImagePart : Part
A data class representing an image part of a prompt. This class handles the conversion of various image sources into a Bitmap upon creation.
Note: Equality is determined by the content of the bitmap (sameAs), not by reference.
Summary
Public constructors |
|---|
Public functions |
|
|---|---|
open operator Boolean |
Compares this ImagePart to another object for equality. |
open Int |
hashCode()Returns a hash code value for the object, consistent with the overridden |
Public properties |
|
|---|---|
Bitmap |
the internal |
Int |
the height of the image in pixels. |
Int |
the width of the image in pixels. |
Public constructors
ImagePart
ImagePart(blob: ByteArray)
Creates an ImagePart from a ByteArray.
| Throws | |
|---|---|
java.lang.IllegalArgumentException |
if the byte array cannot be decoded into a bitmap. |
ImagePart
ImagePart(uri: Uri)
Creates an ImagePart from a Uri. This constructor will perform I/O to decode the image.
| Throws | |
|---|---|
java.io.IOException |
if the URI cannot be read. |
java.lang.IllegalArgumentException |
if the data from the URI cannot be decoded into a bitmap. |