Skip to content

Commit c438b82

Browse files
Refactor: Rename encodeBitmapToBase64Png to encodeBitmapToBase64Jpeg
The private function `encodeBitmapToBase64Png` in `firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/Part.kt` was already compressing Bitmap images to JPEG format, not PNG. This commit renames the function to `encodeBitmapToBase64Jpeg` to accurately reflect its behavior. The single call site within the same file has also been updated.
1 parent 534cc53 commit c438b82

File tree

1 file changed

+2
-2
lines changed
  • firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type

1 file changed

+2
-2
lines changed

firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/Part.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ internal fun Part.toInternal(): InternalPart {
164164
is TextPart -> TextPart.Internal(text)
165165
is ImagePart ->
166166
InlineDataPart.Internal(
167-
InlineDataPart.Internal.InlineData("image/jpeg", encodeBitmapToBase64Png(image))
167+
InlineDataPart.Internal.InlineData("image/jpeg", encodeBitmapToBase64Jpeg(image))
168168
)
169169
is InlineDataPart ->
170170
InlineDataPart.Internal(
@@ -186,7 +186,7 @@ internal fun Part.toInternal(): InternalPart {
186186
}
187187
}
188188

189-
private fun encodeBitmapToBase64Png(input: Bitmap): String {
189+
private fun encodeBitmapToBase64Jpeg(input: Bitmap): String {
190190
ByteArrayOutputStream().let {
191191
input.compress(Bitmap.CompressFormat.JPEG, 80, it)
192192
return android.util.Base64.encodeToString(it.toByteArray(), BASE_64_FLAGS)

0 commit comments

Comments
 (0)