Created
January 23, 2016 01:02
-
-
Save thornpig/4bf981c37c912d3fe570 to your computer and use it in GitHub Desktop.
Create image thumbnail with imageIO on background can make scroll smoother
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CFDataRef imageData = (__bridge CFDataRef)[self getData]; | |
CGImageSourceRef imageSourceRef = CGImageSourceCreateWithData(imageData, nil); | |
CFDictionaryRef options = (__bridge CFDictionaryRef) @{ | |
(id) kCGImageSourceCreateThumbnailWithTransform : @YES, | |
(id) kCGImageSourceCreateThumbnailFromImageAlways : @YES, | |
(id) kCGImageSourceThumbnailMaxPixelSize : @(100)}; | |
CGImageRef imageRef = CGImageSourceCreateThumbnailAtIndex(imageSourceRef, 0 , options); | |
thumbnail = [UIImage imageWithCGImage: imageRef]; | |
return thumbnail; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment