I want to know if Bitmap's memory and byte[] have connection? And the jpeg file is 28kb but when I load the image file to bitmap then I get the bitmap's bytes it's 200 * 1204 byte. Why it is?
If I change the bitmap(A) and compress it to byte[](the byte[] length is 280 * 1024 byte) and then create bitmap(B) from byte[] final, I get the byte[] from the bitmap(B) but the byte[]. Length is not 280 * 1024 byte - why? I can't find any article for this. Who can explain this? Thanks.
byte[] finalData = bitmapUtil.getScaledImageBytes(originBitmap,BitmapUtil.MAX_IMAGE_DATA_LENGTH); (finalData.length 280 * 1024)
originBitmap = BitmapFactory.decodeByteArray(finalData,0,finalData.length);
byte[] now = bitmapUtil.bitmap2Byte(originBitmap); (now.length 400 * 1024)
public byte[] bitmap2Byte(Bitmap bitmap) throws IOException {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG,100,bos);
byte[] data = bos.toByteArray();
bos.close();
return data;
}