Instance Property

renderScale

The scale factor of the frame image relative to the Live Photo’s photo content.

Required.

Declaration

var renderScale: CGFloat { get }

Discussion

Photos calls your frameProcessor block repeatedly, both to process each frame of the Live Photo’s video content and to process the Live Photo’s still photo content. Video frames can be a different size than still photo content—use this value to scale any of your image processing parameters that depend on the image’s size.

For example, the following code uses this property to ensure that the radius of a blur filter is consistent across all frames of a Live Photo:

 
context.frameProcessor = { frame, _ in
    // Apply a blur whose radius is 10 pixels in the photo, scaled accordingly for video frames.
    return frame.image.applyingGaussianBlur(withSigma: frame.renderScale * 10)
}

See Also

Getting Information About the Frame

var time: CMTime

The time offset, in seconds, of this frame relative to the start of the Live Photo.

Required.

var type: PHLivePhotoFrameType

The type of image content in this frame.

Required.

enum PHLivePhotoFrameType

Identifiers for the type of frame image to be processed. Used with the type property.