Reputation: 97
How can I convert all the images stored in one folder to base64
data? in the following code tFotos
is the folder where all my images are stored.
ArrayList<String> mList = new ArrayList<String>();
Bitmap selectedImage = BitmapFactory.decodeFile( Environment.getExternalStorageDirectory()+"tFotos");
ByteArrayOutputStream stream = new ByteArrayOutputStream();
selectedImage.compress(Bitmap.CompressFormat.JPEG, 100,
stream);
byte[] byteArray = stream.toByteArray();
String strBase64 = Base64.encodeToString(byteArray, 0);
mList.add(StrBase64);
Upvotes: 0
Views: 117
Reputation: 294
@Ruben JG You have to provide full path of image like sdcard/foldername/filename.PNG/.JPEG
Upvotes: 1