incubator-callback-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anis KADRI <anis.ka...@gmail.com>
Subject Re: Android Camera Woes
Date Fri, 15 Jun 2012 22:06:56 GMT
I've also used this solution in the past to solve OutOfMemoryErrors
http://bit.ly/LhA1iC
It worked out well

On Fri, Jun 15, 2012 at 2:32 PM, Tim Kim <timkim85@gmail.com> wrote:

> Hey Simon,
>
> It's been awhile since I've been in Android/Java land so here goes.
>
> If anyone knows of some
> > way to edit the image file in place without having to load it in an
> > expensive (memory wise) Bitmap object I'm all ears.
>
>
> I'm guessing this is the operation that's loading it all into a bitmap:
> bitmap =
> android.graphics.BitmapFactory.decodeStream(resolver.openInputStream(uri));
>
> There appears to be a way to grab byte by byte of the input stream [1]. So
> you could potentially write your own decodeStream method that takes in a
> few bytes of the image at a time, do some image proc to resample the image
> to a smaller size by only analysing a small portion of the image at a time,
> then piece together all of the smaller resampled images to form the
> complete smaller bitmap image.
>
> That should save you from loading the entire image in memory but involves
> some trickery with indexing the bytes correctly from the image, resampling
> based on those bytes and piecing everything back together.
>
> [1]:
> http://developer.android.com/reference/java/io/InputStream.html#read(byte[]
> ,
> int, int)
> --
> Timothy Kim
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message