diff --git a/SDWebImage/Core/SDImageCoderHelper.m b/SDWebImage/Core/SDImageCoderHelper.m index de3d0cfc..c29685a9 100644 --- a/SDWebImage/Core/SDImageCoderHelper.m +++ b/SDWebImage/Core/SDImageCoderHelper.m @@ -293,12 +293,15 @@ static const CGFloat kDestSeemOverlap = 2.0f; // the numbers of pixels to over if (input_buffer.data) free(input_buffer.data); if (output_buffer.data) free(output_buffer.data); }; - + BOOL hasAlpha = [self CGImageContainsAlpha:cgImage]; + // iOS display alpha info (BGRA8888/BGRX8888) + CGBitmapInfo bitmapInfo = kCGBitmapByteOrder32Host; + bitmapInfo |= hasAlpha ? kCGImageAlphaPremultipliedFirst : kCGImageAlphaNoneSkipFirst; vImage_CGImageFormat format = (vImage_CGImageFormat) { .bitsPerComponent = 8, .bitsPerPixel = 32, .colorSpace = NULL, - .bitmapInfo = kCGImageAlphaFirst | kCGBitmapByteOrderDefault, + .bitmapInfo = bitmapInfo, .version = 0, .decode = NULL, .renderingIntent = kCGRenderingIntentDefault, diff --git a/SDWebImage/Core/UIImage+Transform.m b/SDWebImage/Core/UIImage+Transform.m index 53fc334c..b1c3fc13 100644 --- a/SDWebImage/Core/UIImage+Transform.m +++ b/SDWebImage/Core/UIImage+Transform.m @@ -606,7 +606,7 @@ static inline CGImageRef _Nullable SDCreateCGImageFromCIImage(CIImage * _Nonnull .bitsPerComponent = 8, .bitsPerPixel = 32, .colorSpace = NULL, - .bitmapInfo = kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Little, //requests a BGRA buffer. + .bitmapInfo = kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host, //requests a BGRA buffer. .version = 0, .decode = NULL, .renderingIntent = kCGRenderingIntentDefault