I am now a newbie to android programming. I am very confused when processing with images. I am now trying to load a jpeg image to bitmap and then convert bitmap to byte array and vice versa. I am testing with the first case: load jpeg to bitmap and get byte array. My input image 520 x 390 (24 bit color) 24KB JPEG. My output byte array is ~ 290000 bytes ~ 290KB, very large from the original one. How can I convert it into byte array with the same size or nearly the same size as the original JPEG? Therefore, I wonder if the inverse conversion will convert byte array to jpeg the same size or not ?
Here is my code:
Resources r = this.getResources();
Bitmap bm = BitmapFactory.decodeResource(r,R.drawable.plot);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
bm.compress(Bitmap.CompressFormat.JPEG,100,baos);
byte[] byteArray = baos.toByteArray();