Merge pull request #2739 from dreampiggy/fix_encoding_imageio_warning
Fix that `CGImageDestinationCreateWithData` 0 count arg will log a warning
This commit is contained in:
commit
0e255db4df
|
@ -193,7 +193,8 @@ const CFStringRef kCGImagePropertyAPNGUnclampedDelayTime = (__bridge CFStringRef
|
|||
NSArray<SDImageFrame *> *frames = [SDImageCoderHelper framesFromAnimatedImage:image];
|
||||
|
||||
// Create an image destination. APNG does not support EXIF image orientation
|
||||
CGImageDestinationRef imageDestination = CGImageDestinationCreateWithData((__bridge CFMutableDataRef)imageData, imageUTType, frames.count, NULL);
|
||||
// The `CGImageDestinationCreateWithData` will log a warning when count is 0, use 1 instead.
|
||||
CGImageDestinationRef imageDestination = CGImageDestinationCreateWithData((__bridge CFMutableDataRef)imageData, imageUTType, frames.count ?: 1, NULL);
|
||||
if (!imageDestination) {
|
||||
// Handle failure.
|
||||
return nil;
|
||||
|
|
|
@ -269,7 +269,8 @@
|
|||
NSArray<SDImageFrame *> *frames = [SDImageCoderHelper framesFromAnimatedImage:image];
|
||||
|
||||
// Create an image destination. GIF does not support EXIF image orientation
|
||||
CGImageDestinationRef imageDestination = CGImageDestinationCreateWithData((__bridge CFMutableDataRef)imageData, imageUTType, frames.count, NULL);
|
||||
// The `CGImageDestinationCreateWithData` will log a warning when count is 0, use 1 instead.
|
||||
CGImageDestinationRef imageDestination = CGImageDestinationCreateWithData((__bridge CFMutableDataRef)imageData, imageUTType, frames.count ?: 1, NULL);
|
||||
if (!imageDestination) {
|
||||
// Handle failure.
|
||||
return nil;
|
||||
|
|
Loading…
Reference in New Issue