Memory efficient way to scale an image
<p>I've got an app where the main viewing area is a WebView.  </p>

<p>It's a service where a user can also upload a photo.  However, with the WebView, and photo uploads, I'm getting some OutOfMemoryErrors.</p>

<p>Usually all it takes is a page loaded in the WebView, and then simply trying to open an image with something like this:</p>

<pre><code>Bitmap bmp = BitmapFactory.decodeFile(path);
</code></pre>

<p>The <em>only</em> reason I need to open the file at all is so that I can scale it down so that it fits in a max width/max height dimensions before uploading it.</p>

<p>I've even tried opening it in a sampled fashion, similar to what's mentioned here:</p>

<p><a href="http://stackoverflow.com/questions/477572/android-strange-out-of-memory-issue/823966#823966">Android: Strange out of memory issue</a></p>

<p>However, with a complex webpage loaded in the WebView, I still get OutOfMemoryError when trying to open the image.</p>

<p>Is there a way to scale it, maybe using another process or something, that's more memory efficient?</p>
