Creating a Core Graphics Image from a vImage Buffer
Create displayable representations of vImage buffers.
Overview
vImage provides a function for creating Core Graphics images from vImage buffers. This function allows you to display the results of a vImage operation to your user.
Create the Image
You create a Core Graphics image from the buffer, and initialize a UIImage instance from that. The createCGImage(format:flags:) function returns a CGImage instance based on the supplied Core Graphics image format (for more information, see Converting bitmap data between Core Graphics images and vImage buffers).
The following example shows how to create a Core Graphics image from a vImage buffer:
let result = try? destinationBuffer.createCGImage(format: format)
if let result = result {
// Assumes `imageView` is a `UIImageView`
imageView.image = UIImage(cgImage: result)
}See Also
Image Processing Essentials
Converting bitmap data between Core Graphics images and vImage buffersCreating and Populating Buffers from Core Graphics ImagesBuilding a Basic Image-Processing WorkflowApplying geometric transforms to imagesCompositing images with alpha blendingCompositing images with vImage blend modesApplying vImage operations to regions of interestOptimizing image-processing performancevImage