Retrieving a pixel alpha value for a UIImage (MonoTouch)
This question is a duplicate of 1042830 , but MonoTouch-specific. Is there a way that's safer than allocating an IntPtr, drawing into it using CGBitmapContext and then reading bytes at the appropriate offset? I don't know if it's kosher to answer your own question, but: protected CGBitmapContext CreateARGBBitmapContext(CGImage inImage) { var pixelsWide = inImage.Width; var pixelsHigh = inImage.Height; var bitmapBytesPerRow = pixelsWide * 4; var bitmapByteCount = bitmapBytesPerRow * pixelsHigh; //Note implicit colorSpace.Dispose() using(var colorSpace = CGColorSpace.CreateDeviceRGB()) { /