Skip to content

Commit 37f71de

Browse files
matejOlivier Poitrey
authored and
Olivier Poitrey
committed
Using the source image's the color space for image decoding (fix SDWebImage#237)
Should fix most system warnings regarding invalid context configurations
1 parent a94b3ec commit 37f71de

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

SDWebImage/SDWebImageDecoder.m

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@ + (UIImage *)decodedImageWithImage:(UIImage *)image
1818
CGSize imageSize = CGSizeMake(CGImageGetWidth(imageRef), CGImageGetHeight(imageRef));
1919
CGRect imageRect = (CGRect){.origin = CGPointZero, .size = imageSize};
2020

21-
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
21+
CGColorSpaceRef colorSpace = CGImageGetColorSpace(imageRef);
2222
CGContextRef context = CGBitmapContextCreate(NULL, imageSize.width, imageSize.height, CGImageGetBitsPerComponent(imageRef), CGImageGetBytesPerRow(imageRef), colorSpace, CGImageGetBitmapInfo(imageRef));
23-
CGColorSpaceRelease(colorSpace);
2423

2524
// If failed, return undecompressed image
2625
if (!context) return image;

0 commit comments

Comments
 (0)