From c32f9c03f816dac58a8cac25d6189310272ca9c1 Mon Sep 17 00:00:00 2001 From: Olivier Poitrey Date: Wed, 12 Sep 2012 02:45:54 +0200 Subject: [PATCH] Remove alpha channel (may break some PNG/GIF with alpha, pull request welcome) --- SDWebImage/SDWebImageDecoder.m | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/SDWebImage/SDWebImageDecoder.m b/SDWebImage/SDWebImageDecoder.m index 623255b..9b6e50c 100644 --- a/SDWebImage/SDWebImageDecoder.m +++ b/SDWebImage/SDWebImageDecoder.m @@ -107,7 +107,10 @@ static SDWebImageDecoder *sharedInstance; // System only supports RGB, set explicitly colorSpace, // Makes system don't need to do extra conversion when displayed. - kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Little); + // NOTE: here we remove the alpha channel for performance. Most of the time, images loaded + // from the network are jpeg with no alpha channel. As a TODO, finding a way to detect + // if alpha channel is necessary would be nice. + kCGImageAlphaNoneSkipLast | kCGBitmapByteOrder32Little); CGColorSpaceRelease(colorSpace); if (!context) return nil;