Skip to content

Instantly share code, notes, and snippets.

@MartinJNash
Last active August 29, 2015 13:59
Show Gist options
  • Save MartinJNash/10489675 to your computer and use it in GitHub Desktop.
Save MartinJNash/10489675 to your computer and use it in GitHub Desktop.
ALAssetRepresentation *rep = [asset defaultRepresentation];
NSDictionary *dict = [rep metadata];
NSString *xmp = dict[@"AdjustmentXMP"];
NSData *xmpData = [xmp dataUsingEncoding:NSUTF8StringEncoding];
NSError *e = nil;
NSArray *filters = [CIFilter filterArrayFromSerializedXMP:xmpData inputImageExtent:CGRectZero error:&e];
CIFilter *filter = [filters firstObject];
CIImage *image =[CIImage imageWithCGImage: [rep fullScreenImage]];
[filter setValue:image forKey:kCIInputImageKey];
CIImage *outputImage = [filter outputImage];
UIImage *filteredImage = [UIImage imageWithCIImage:outputImage];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment