I am converting bitmap from bytes array using following code:
InputStream is = getInputStreamFromURL(urlStr);
if (is != null) {
ByteArrayOutputStream os = new ByteArrayOutputStream(1024);
byte[] data = new byte[1024 * 10];
int len;
while ((len = is.read(data, 0, data.length)) != -1) {
os.write(data, 0, len);
}
is.close();
byte[] imageArray = os.toByteArray();
Log.d(TAG, "imageArray.length: "+imageArray.length); // Size 72.1 KB
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = false;
bitmap = BitmapFactory.decodeByteArray(imageArray, 0, imageArray.length/*, options*/);
Log.d(TAG, "getByteCount: "+bitmap.getByteCount()); // Size 1.7 MB
}
But after converting bitmap from byte array its size increased (dimensions are still same):
Original image size = 72.1 KB
After converting it to bitmap = 1.7 MB.
Can anyone help me? Why it happens or what is wrong in code?