incubator-callback-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon MacDonald <simon.macdon...@gmail.com>
Subject Re: Android Camera Woes
Date Sat, 16 Jun 2012 00:37:38 GMT
That sounds like a whole lot of not fun but it may come to that.

Simon Mac Donald
http://hi.im/simonmacdonald


On Fri, Jun 15, 2012 at 5: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
View raw message