diff --git a/SDWebImage/SDImageCache.m b/SDWebImage/SDImageCache.m index 10506e82..75be7b41 100644 --- a/SDWebImage/SDImageCache.m +++ b/SDWebImage/SDImageCache.m @@ -15,6 +15,7 @@ #import "SDImageCoderHelper.h" #import "SDAnimatedImage.h" #import "UIImage+MemoryCacheCost.h" +#import "UIImage+Metadata.h" @interface SDImageCache () @@ -378,6 +379,15 @@ // First check the in-memory cache... UIImage *image = [self imageFromMemoryCacheForKey:key]; + + if ((options & SDImageCacheDecodeFirstFrameOnly) && image.sd_isAnimated) { +#if SD_MAC + image = [[NSImage alloc] initWithCGImage:image.CGImage scale:image.scale orientation:kCGImagePropertyOrientationUp]; +#else + image = [[UIImage alloc] initWithCGImage:image.CGImage scale:image.scale orientation:image.imageOrientation]; +#endif + } + BOOL shouldQueryMemoryOnly = (image && !(options & SDImageCacheQueryMemoryData)); if (shouldQueryMemoryOnly) { if (doneBlock) {