incubator-callback-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Kim <timki...@gmail.com>
Subject Re: Android Camera Woes
Date Fri, 15 Jun 2012 21:32:30 GMT
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