Bytes
An image stored as raw bytes with a MIME type.
Samples
val imageBytes = try {
// Read bytes from file(example)
readBytes("path/to/photo.jpg")
} catch (fNEx: FileNotFoundException) {
println("Image not found, detail message: ${fNEx.message}")
null
} catch (e: Exception) {
println("Error on reading image bytes: ${e.message}")
null
}
imageBytes?.let { bytes ->
val source = ImageSource.Bytes(
bytes = bytes
)
// Add image Source to content and send to API...
}Content copied to clipboard