Package com.example.oblong
Class imageUtils
java.lang.Object
com.example.oblong.imageUtils
Utility class for encoding Bitmaps to Base64 strings and decoding Base64 strings back to Bitmaps.
for storage in Firebase since Base64 gets stored as a string
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic android.graphics.Bitmap
base64ToBitmap
(String base64String) Converts a Base64-encoded string back to a Bitmap image.static String
bitmapToBase64
(android.graphics.Bitmap bitmap) Converts a Bitmap image to a Base64-encoded string.
-
Constructor Details
-
imageUtils
public imageUtils()
-
-
Method Details
-
bitmapToBase64
Converts a Bitmap image to a Base64-encoded string.- Parameters:
bitmap
- The Bitmap image to encode.- Returns:
- A Base64-encoded string representing the image.
-
base64ToBitmap
Converts a Base64-encoded string back to a Bitmap image.- Parameters:
base64String
- The Base64-encoded string to decode.- Returns:
- A Bitmap image decoded from the Base64 string.
-