Fix the case that provided DPI cause `kCGImagePropertyPixelWidth` return non-zero value

This will cause re-check thumbnail, and may result the wrong pixel size
This commit is contained in:
DreamPiggy 2022-07-14 14:52:26 +08:00
parent f1fe4ca8b8
commit 2fe3879b15
1 changed files with 5 additions and 0 deletions

View File

@ -132,8 +132,13 @@ static NSString * kSDCGImageDestinationRequestedFileSize = @"kCGImageDestination
}
}
decodingOptions = @{
// This option will cause ImageIO return the pixel size from `CGImageSourceCopyProperties`
// If not provided, it always return 0 size
kSDCGImageSourceRasterizationDPI : @(rasterizationDPI),
};
// Already calculated DPI, avoid re-calculation based on thumbnail information
preserveAspectRatio = YES;
thumbnailSize = CGSizeZero;
}
UIImage *image = [SDImageIOAnimatedCoder createFrameAtIndex:0 source:source scale:scale preserveAspectRatio:preserveAspectRatio thumbnailSize:thumbnailSize options:decodingOptions];