Extract UIColor from UIImage @ CGPoint

This code snippett will allow you to extract the UIColor of a pixel in a UIImage at a given CGPoint. This is useful for apps that deal with pictures or colors. First of all the code: extension UIImage { public func getPixelColor(pos: CGPoint) -> UIColor { let pixelData = self.cgImage!.dataProvider!.data let data: UnsafePointer<UInt8> = CFDataGetBytePtr(pixelData)…

Scroll to top