Skip to content

Commit d568e84

Browse files
Refactor: Rename encodeBitmapToBase64Png to encodeBitmapToBase64Jpeg (#6905)
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. no-changelog Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
1 parent e9ef479 commit d568e84

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ internal fun Part.toInternal(): InternalPart {
171171
is TextPart -> TextPart.Internal(text)
172172
is ImagePart ->
173173
InlineDataPart.Internal(
174-
InlineDataPart.Internal.InlineData("image/jpeg", encodeBitmapToBase64Png(image))
174+
InlineDataPart.Internal.InlineData("image/jpeg", encodeBitmapToBase64Jpeg(image))
175175
)
176176
is InlineDataPart ->
177177
InlineDataPart.Internal(
@@ -193,7 +193,7 @@ internal fun Part.toInternal(): InternalPart {
193193
}
194194
}
195195

196-
private fun encodeBitmapToBase64Png(input: Bitmap): String {
196+
private fun encodeBitmapToBase64Jpeg(input: Bitmap): String {
197197
ByteArrayOutputStream().let {
198198
input.compress(Bitmap.CompressFormat.JPEG, 80, it)
199199
return android.util.Base64.encodeToString(it.toByteArray(), BASE_64_FLAGS)

0 commit comments

Comments
 (0)