diff --git a/FXBlurView/FXBlurView.m b/FXBlurView/FXBlurView.m index 73c6f91..55d2b22 100755 --- a/FXBlurView/FXBlurView.m +++ b/FXBlurView/FXBlurView.m @@ -117,10 +117,26 @@ - (UIImage *)blurredImageWithRadius:(CGFloat)radius iterations:(NSUInteger)itera free(buffer2.data); free(tempBuffer); + CGImageAlphaInfo alphaInfo = CGImageGetBitmapInfo(imageRef) & kCGBitmapAlphaInfoMask; + + //Since iOS8 it's not allowed anymore to create contexts with unmultiplied Alpha info + if (alphaInfo == kCGImageAlphaLast) { + alphaInfo = kCGImageAlphaPremultipliedLast; + } + if (alphaInfo == kCGImageAlphaFirst) { + alphaInfo = kCGImageAlphaPremultipliedFirst; + } + + //reset the bits + CGBitmapInfo newBitmapInfo = CGImageGetBitmapInfo(imageRef) & ~kCGBitmapAlphaInfoMask; + + //set the bits to the new alphaInfo + newBitmapInfo |= alphaInfo; + //create image context from buffer CGContextRef ctx = CGBitmapContextCreate(buffer1.data, buffer1.width, buffer1.height, 8, buffer1.rowBytes, CGImageGetColorSpace(imageRef), - CGImageGetBitmapInfo(imageRef)); + newBitmapInfo); //apply tint if (tintColor && CGColorGetAlpha(tintColor.CGColor) > 0.0f)