Google this: ColorMatrix threshold Here is a link that may be useful: http://keywon.com/wiki/index.php?title=ColorMatrix
Draw your bitmap (newBitmap) into a bitmap-backed canvas (c) that has a ColorMatrixColorFilter set with a ColorMatrix that represents a so- called 'threshold' filter (see above link). On Apr 1, 5:14 pm, paladin <quoti...@gmail.com> wrote: > I am using the following code to flip each pixel in a bitmap to black > or white: > > for(int x = 0; x < newBitmap.getWidth(); x++) { > for(int y = 0; y < newBitmap.getHeight(); y++) { > int point = newBitmap.getPixel(x, y); > if(point < Color.GRAY) { > paint.setColor(Color.BLACK); > c.drawPoint(x, y, paint); > } else { > paint.setColor(Color.WHITE); > c.drawPoint(x, y, paint); > } > } > } > > It works, but it is extraordinarily slow for the size image I'm using > (half the resolution of the camera, 1296x972). I have also tried > setPixel, and I'm getting about the same performance. Anyone out there > know of a faster way to do this? -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using "remove me" as the subject.