Skip to content

Instantly share code, notes, and snippets.

@mrpossoms
Created March 24, 2016 16:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrpossoms/bcbc56c320251200f8e5 to your computer and use it in GitHub Desktop.
Save mrpossoms/bcbc56c320251200f8e5 to your computer and use it in GitHub Desktop.
CGDataProviderRef provider = CGDataProviderCreateWithData(NULL,
snap->data,
snap->current.width * snap->current.height * 4,
NULL);
CGColorSpaceRef colorSpaceRef = CGColorSpaceCreateDeviceRGB();
CGBitmapInfo bitmapInfo = kCGBitmapByteOrderDefault;
CGColorRenderingIntent renderingIntent = kCGRenderingIntentDefault;
CGImageRef imageRef = CGImageCreate(snap->current.width,
snap->current.height,
8,
32,
4 * snap->current.width,colorSpaceRef,
bitmapInfo,
provider,NULL,NO,renderingIntent);
/*I get the current dimensions displayed here */
UIImage *newImage = [UIImage imageWithCGImage:imageRef];
NSLog(@"%@", newImage);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment