- Where Developers Learn, Share, & Build Careers
I am creating an application that will take large images from the SD card and then make them black and white and Will save in the card. I can not read large images directly. So need to use a stream. Can someone provide me a solution? PS: I tried to do a lot to find an answer for this issue, but it has not been able. , modify the data buffer for black and whith only the color of the outstanding pixel, go back to the offset where you do one Start reading and with black and pixels. Edit: OK, in fact, I do not think that reading is a solution to the file because Android does not allow you to get raw bytes of your image. You can use a small part of your image to read: using RandomAccessFile to access the file
Reading / Write mode:
RandomAccessFile file = new RandomAccessFile ("yourimage", "rw"); You can read a section of data compared to
Bitmap regeon decoder decoder = bitmap region decoder.New instance (Mystream, Falls); Bitmap bitmapril = decoder Decode regian (new rake (left, top, right, bottom), blank); To create a black and white image, use
ColorMatrix if you can link to aginst
libjpeg , then the bitmap Get the byte and convert it to black and white The easiest way is by the method you have read 3 bytes once (R, G, B). Then takes the impression:
unsigned char R; Unsigned char b; Unsigned four G; Int color = (r + g + b) / 3; If (Color> THRESHOLD) returns 255; Return 0;
Comments
Post a Comment