Merge pull request #3015 from dreampiggy/fix_max_pixel_size_larger_than_image_size
Fix the issue that ImageIO max pixel size larger than image size will cause a upscale
This commit is contained in:
commit
ab80a9e3d1
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue