Update the check logic to detect `Multiple Frame Animated Image`

This commit is contained in:
DreamPiggy 2023-05-15 14:51:42 +08:00
parent 2331bcc690
commit f3ea1eee67
1 changed files with 3 additions and 3 deletions

View File

@ -262,7 +262,7 @@ static NSString * _defaultDiskCacheDirectory;
SDImageFormat format = image.sd_imageFormat;
if (format == SDImageFormatUndefined) {
// If image is animated, use GIF (APNG may be better, but has bugs before macOS 10.14)
if (image.sd_isAnimated) {
if (image.sd_imageFrameCount > 1) {
format = SDImageFormatGIF;
} else {
// If we do not have any data to detect image format, check whether it contains alpha channel to use PNG or JPEG format
@ -461,7 +461,7 @@ static NSString * _defaultDiskCacheDirectory;
if (image) {
if (options & SDImageCacheDecodeFirstFrameOnly) {
// Ensure static image
if (image.sd_isAnimated) {
if (image.sd_imageFrameCount > 1) {
#if SD_MAC
image = [[NSImage alloc] initWithCGImage:image.CGImage scale:image.scale orientation:kCGImagePropertyOrientationUp];
#else
@ -593,7 +593,7 @@ static NSString * _defaultDiskCacheDirectory;
if (image) {
if (options & SDImageCacheDecodeFirstFrameOnly) {
// Ensure static image
if (image.sd_isAnimated) {
if (image.sd_imageFrameCount > 1) {
#if SD_MAC
image = [[NSImage alloc] initWithCGImage:image.CGImage scale:image.scale orientation:kCGImagePropertyOrientationUp];
#else