I am creating an application which will take large images from SD card and then make them black and white and save them to SD card.I cannot read the large images directly.So need to use a stream.Can any one provide me with a solution.
PS:I tried a lot to find an answer for this issue,but has not been able to.
Thanking you in advance
I am creating an application which will take large images from SD card and
Share
Use a
RandomAccessFileto get access to the file inread/writemode:than you can read a chunck of data with public int read (byte[] buffer), modify the data buffer in order to get the color of the pixel only black and whith, do a public void seek (long offset) to return at the offset where you start reading and public void write (byte[] buffer) the black and with pixels.
EDIT:
Ok, actually I think that reading from file is not the solution since android does not allow to get the raw bytes of your image. You can use BitmapRegionDecoder, to read smull chunk of your image:
than use
ColorMatrixto create a black and white image. If you can link aginstlibjpeg, is straightforward get the raw bitmap bytes and convert it in black and white. The simplest way is the avarge method. You read 3 bytes a time (R, G, B). Then takes the avarage: