     
     var image:UIImage! {
         didSet {
+            precondition(image.CGImage != nil, "SNTrimController does not support an image created from CIImage.")
             guard let device = SNTrimController.device else {
                 return
             }

        var bitmapInfo: UInt32 = CGBitmapInfo.ByteOrder32Big.rawValue
        bitmapInfo |= CGImageAlphaInfo.PremultipliedLast.rawValue & CGBitmapInfo.AlphaInfoMask.rawValue
        let context = CGBitmapContextCreate(data.mutableBytes, Int(size.width), Int(size.height), 8, 4 * Int(size.width), CGColorSpaceCreateDeviceRGB(), bitmapInfo)!
        CGContextDrawImage(context, CGRect(origin: .zero, size:size), trimmedImage.CGImage)
        let words = UnsafeMutablePointer<UInt32>(data.mutableBytes)

        let start = NSDate()

                CGContextRestoreGState(imageContext)

                CGContextSetBlendMode(imageContext, CGBlendMode.DestinationOut)
                CGContextDrawImage(imageContext, rc, maskImage.CGImage!)

                let imageBrush = UIGraphicsGetImageFromCurrentImageContext()!
                UIGraphicsEndImageContext()

                CGContextSetBlendMode(context, CGBlendMode.DestinationOut)
                CGContextDrawImage(context, rc, imageBrush.CGImage!)
            } else {
                CGContextConcatCTM(context, imageTransform)
                CGContextSetBlendMode(context, CGBlendMode.DestinationOut)
