Instance Property


A block to be called by Photos for processing each frame of the Live Photo’s visual content.


@property(copy) PHLivePhotoFrameProcessingBlock frameProcessor;


Use this property to define the image processing to be performed on each frame of the Live Photo. Setting this property does not begin processing; instead, after you call one of the methods listed in Processing an Editing Context’s Live Photo, Photos executes your block repeatedly to process each frame of the Live Photo’s video and still photo content.

In your frame processor block, use the image property of the provided PHLivePhotoFrame object to access the image to be processed, and return a CIImage object representing the result of your processing. For example, the following code sets up a processor block to apply a simple sepia-tone filter, then calls the saveLivePhotoToOutput:options:completionHandler: method to begin processing the Live Photo for output.

- (void)processLivePhoto:(PHContentEditingInput *)input {
    PHLivePhotoEditingContext *context = [[PHLivePhotoEditingContext alloc] initWithLivePhotoEditingInput:input];
    context.frameProcessor = ^CIImage *(id <PHLivePhotoFrame> frame, NSError **error) {
        return [frame.image imageByApplyingFilter:@"CISepiaTone" withInputParameters:nil];
    PHContentEditingOutput *output = [[PHContentEditingOutput alloc] initWithContentEditingInput: input];
    [context saveLivePhotoToOutput:output options:nil completionHandler:^(PHLivePhoto *livePhoto, NSError *error) {
        if (success) {
            // use output with PHAssetChangeRequest or PHContentEditingController
        } else {
            NSLog(@"can't process: %@", error);

See Also

Preparing an Editing Context for Processing


The signature for a block Photos calls to process Live Photo frames.


The audio gain to apply to the processed Live Photo.