title: Compress Bitmap from Camera
body: <p>I need to send an image taken from the Camera over network. The image is too large to create a bitmap needed to use bitmap.compress(); It looks like the Gmail application can attach images from the camera while maintaining their large pixel size but with a great reduction their file size. </p>
  
  <p>This won't work because I getBitmap() will return an Image to large to allocate and I don't want to sub sample it down to a smaller size.</p>
  
  <pre><code>    ByteArrayOutputStream baos = new ByteArrayOutputStream();
      getBitmap().compress(Bitmap.CompressFormat.JPEG, 70, baos);
  </code></pre>
  
  <p>Any ideas on how I can do the same without exceeding my total memory?</p>
  
  <p><strong>Update:</strong></p>
  
  <p>For anyone coming back to this thread I followed Phil's answer and used Apache MultiPartEntity to get the job done easily. (It handles streaming files from disk to network for you) <a href="http://hc.apache.org/httpcomponents-client-ga/httpmime/apidocs/org/apache/http/entity/mime/MultipartEntity.html" rel="nofollow">http://hc.apache.org/httpcomponents-client-ga/httpmime/apidocs/org/apache/http/entity/mime/MultipartEntity.html</a></p>