笹岡 愛 As per the REST API reference, I think the image binary should be in base 64 format.
I do not have experience in using kotlin or bitmap images, but I found a reference of this conversion in Java from this page on internet.
val baos = ByteArrayOutputStream()
val compress = imageBitmap!!.compress(Bitmap.CompressFormat.PNG, 100, baos)
byte[] bytes=baos.toByteArray();
sImage= Base64.encodeToString(bytes,Base64.DEFAULT);
val faceId = FaceApi.detectWithStream(sImage)
?:return@launch
The above syntax may be incorrect but I think if you use it base64 format the API should detect the stream data as valid.
Ref: https://www.geeksforgeeks.org/how-to-encode-and-decode-image-in-base64-in-android/
If this answers your query, do click Accept Answer
and Yes
for was this answer helpful. And, if you have any further query do let us know.