title: Android Bitmap won't compress
body: <p>I'm trying to compress a Bitmap which is taken from either the user's gallery or camera and store it as a profile picture in a Parse Server.</p>
  
  <p>The issue is the bitmap will NOT compress. The image saves perfectly fine and is useable in the database, but the file size is massive for just a profile picture.</p>
  
  <p>Here's my current code:</p>
  
  <pre><code>//Compressing
  ByteArrayOutputStream stream = new ByteArrayOutputStream();
  profilePictureBitmap.compress(Bitmap.CompressFormat.PNG, 20, stream);
  byte[] image = stream.toByteArray();
  
  //Saving
  String imageName = username + "_profile_picture.png";
  final ParseFile file = new ParseFile(imageName, image);
  file.saveInBackground(new SaveCallback() {
      @Override
      public void done(ParseException e) {
          if(e == null) {
              user.put("profilePicture", file);
              user.signUpInBackground();
          }
      }
  }
  </code></pre>
  
  <p>I'm using a image picker library that gets the path of the image. I then turn it into a bitmap.</p>
  
  <p>Heres my code to retrieve the image:</p>
  
  <pre><code>ArrayList&lt;Image&gt; images = data.getParcelableArrayListExtra(ImagePickerActivity.INTENT_EXTRA_SELECTED_IMAGES);
  if(images.size() &gt; 0) {
      Image image = images.get(0);
      File imgFile = new File(image.getPath());
      if(imgFile.exists()){
          profilePictureBitmap = BitmapFactory.decodeFile(imgFile.getAbsolutePath());
          profilePictureImage.setImageBitmap(profilePictureBitmap);
      }
  }
  </code></pre>
  
  <p>If there is any ideas on how to fix this I would greatly appreciate it.
  Thanks :]</p>