title: How to compress bitmap from 10mb image from camera to 300kb beforw setting to imageview in android
body: <h2>I have a a pice of code:</h2>
  
  <pre><code>Bitmap bitmap;
  BitmapFactory.Options bitmapOptions = new BitmapFactory.Options();
  bitmap = BitmapFactory.decodeFile(f.getAbsolutePath(),bitmapOptions); 
  </code></pre>
  
  <p><strong><em>finally bitmap has the image from camera (i am taking image from a high resolution camera ) so size may be 10mb.</em></strong></p>
  
  <hr>
  
  <h2>What i am trying to do::</h2>
  
  <p>I am trying to set the bitmap in imageview as below</p>
  
  <pre><code>portfolioPicImgId.setImageBitmap(bitmap);
  </code></pre>
  
  <ul>
  <li>Before that i want to compress the image into 300kb how can I achieve
  this !</li>
  <li>I have seen other stackoverflow answers but how to specify exactly to
  300kb</li>
  </ul>