Skip to content

Instantly share code, notes, and snippets.

@thornpig
Created January 23, 2016 01:02
Show Gist options
  • Save thornpig/4bf981c37c912d3fe570 to your computer and use it in GitHub Desktop.
Save thornpig/4bf981c37c912d3fe570 to your computer and use it in GitHub Desktop.
Create image thumbnail with imageIO on background can make scroll smoother
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