How-To: Convert UIImage to Greyscale Equivalent
Sep.28, 2009 in
iPhone Development
Here’s a simple code snippet for converting a UIImage to a greyscale equivalent: -(UIImage *) convertToGreyscale:(UIImage *)i { int kRed = 1; int kGreen = 2; int kBlue = 4; int colors = kGreen; int m_width = i.size.width; int m_height = i.size.height; uint32_t *rgbImage = (uint32_t *) malloc(m_width * m_height * sizeof(uint32_t)); CGColorSpaceRef colorSpace = [...]
