I need to get a pure black and white UIImage from another UIImage (not grayscale). Anyone can help me?
Thanks for reading.
EDITED:
Here
This code may help:
for (int i = 0; i < image.size.width * image.size.height * 4; i += 4) {
if (dataBitmap[i + 0] >= dataBitmap[i + 1] && dataBitmap[i + 0] >= dataBitmap[i + 2]){
dataBitmap[i + 1] = dataBitmap[i + 0];
dataBitmap[i + 2] = dataBitmap[i + 0];
}
else if (dataBitmap[i + 1] >= dataBitmap[i + 0] && dataBitmap[i + 1] >= dataBitmap[i + 2]) {
dataBitmap[i + 0] = dataBitmap[i + 1];
dataBitmap[i + 2] = dataBitmap[i + 1];
}
else {
dataBitmap[i + 0] = dataBitmap[i + 2];
dataBitmap[i + 1] = dataBitmap[i + 2];
}
}