Android : How to compress bitmap from 10mb image from camera to 300kb beforw setting to imageview in android

on Wednesday, December 10, 2014


I have a a pice of code:



Bitmap bitmap;
BitmapFactory.Options bitmapOptions = new BitmapFactory.Options();
bitmap = BitmapFactory.decodeFile(f.getAbsolutePath(),bitmapOptions);


finally bitmap has the image from camera (i am taking image from a high resolution camera ) so size may be 10mb.




What i am trying to do::


I am trying to set the bitmap in imageview as below



portfolioPicImgId.setImageBitmap(bitmap);



  • Before that i want to compress the image into 300kb how can I achieve this !

  • I have seen other stackoverflow answers but how to specify exactly to 300kb


0 comments:

Post a Comment