diff --git a/SDWebImage/Core/SDImageIOCoder.m b/SDWebImage/Core/SDImageIOCoder.m index 11565e12..715b0205 100644 --- a/SDWebImage/Core/SDImageIOCoder.m +++ b/SDWebImage/Core/SDImageIOCoder.m @@ -277,7 +277,7 @@ static NSString * kSDCGImageDestinationRequestedFileSize = @"kCGImageDestination } NSUInteger pixelWidth = CGImageGetWidth(imageRef); NSUInteger pixelHeight = CGImageGetHeight(imageRef); - if (maxPixelSize.width > 0 && maxPixelSize.height > 0 && pixelWidth > 0 && pixelHeight > 0) { + if (maxPixelSize.width > 0 && maxPixelSize.height > 0 && pixelWidth > maxPixelSize.width && pixelHeight > maxPixelSize.height) { CGFloat pixelRatio = pixelWidth / pixelHeight; CGFloat maxPixelSizeRatio = maxPixelSize.width / maxPixelSize.height; CGFloat finalPixelSize;