CIImage
A representation of an image to be processed or produced by Core Image filters.
Declaration
class CIImageMentioned in
Overview
You use CIImage objects in conjunction with other Core Image classes—such as CIFilter, CIContext, CIVector, and CIColor—to take advantage of the built-in Core Image filters when processing images. You can create CIImage objects with data supplied from a variety of sources, including Quartz 2D images, Core Video image buffers (CVImageBuffer), URL-based objects, and NSData objects.
Although a CIImage object has image data associated with it, it is not an image. You can think of a CIImage object as an image “recipe.” A CIImage object has all the information necessary to produce an image, but Core Image doesn’t actually render an image until it is told to do so. This lazy evaluation allows Core Image to operate as efficiently as possible. To show a CIImage object as an on-screen image, you can display it as a UIImage in UIImageView:
CIContext and CIImage objects are immutable, which means each can be shared safely among threads. Multiple threads can use the same GPU or CPU CIContext object to render CIImage objects. However, this is not the case for CIFilter objects, which are mutable. A CIFilter object cannot be shared safely among threads. If you app is multithreaded, each thread must create its own CIFilter objects. Otherwise, your app could behave unexpectedly.
Core Image also provides auto-adjustment methods. These methods analyze an image for common deficiencies and return a set of filters to correct those deficiencies. The filters are preset with values for improving image quality by altering values for skin tones, saturation, contrast, and shadows and for removing red-eye or other artifacts caused by flash. (See Getting Autoadjustment Filters.)
For a discussion of all the methods you can use to create CIImage objects on iOS and macOS, see Core Image Programming Guide.
Topics
Creating an Image
empty()init(image:)init(image:options:)init(contentsOf:)init(contentsOf:options:)init(cgImage:)init(cgImage:options:)init(cgImageSource:index:options:)init(data:)init(data:options:)init(bitmapData:bytesPerRow:size:format:colorSpace:)init(bitmapImageRep:)init(imageProvider:size:_:format:colorSpace:options:)init(depthData:)init(depthData:options:)init(portaitEffectsMatte:)init(portaitEffectsMatte:options:)init(semanticSegmentationMatte:)init(semanticSegmentationMatte:options:)init(cvImageBuffer:)init(cvImageBuffer:options:)init(cvPixelBuffer:)init(cvPixelBuffer:options:)init(mtlTexture:options:)init(ioSurface:)init(ioSurface:options:)
Creating an Image by Modifying an Existing Image
applyingFilter(_:parameters:)applyingFilter(_:)transformed(by:)transformed(by:highQualityDownsample:)cropped(to:)oriented(forExifOrientation:)clampedToExtent()clamped(to:)composited(over:)convertingWorkingSpaceToLab()convertingLabToWorkingSpace()matchedToWorkingSpace(from:)matchedFromWorkingSpace(to:)premultiplyingAlpha()unpremultiplyingAlpha()settingAlphaOne(in:)applyingGaussianBlur(sigma:)settingProperties(_:)insertingIntermediate()insertingIntermediate(cache:)
Creating Solid Colors
Getting Image Information
Drawing Images
Getting Autoadjustment Filters
Working with Filter Regions of Interest
Working with Orientation
Sampling the Image
Accessing Original Image Content
Image Dictionary Keys
AutoAdjustment Keys
Deprecated
init(cgLayer:)init(cgLayer:options:)init(texture:size:flipped:colorSpace:)init(texture:size:flipped:options:)init(ioSurface:plane:format:options:)textureTargettextureFormat
Instance Properties
Instance Methods
applyingGainMap(_:)applyingGainMap(_:headroom:)insertingTiledIntermediate()settingContentAverageLightLevel(_:)settingContentHeadroom(_:)
Initializers
init(CGImage:)init(CGImage:)init(CGImage:options:)init(CGImage:options:)init(CGImageSource:index:options:)init(CGImageSource:index:options:)init(CGLayer:)init(CGLayer:)init(CGLayer:options:)init(CGLayer:options:)init(CVImageBuffer:)init(CVImageBuffer:)init(CVImageBuffer:options:)init(CVImageBuffer:options:)init(CVPixelBuffer:)init(CVPixelBuffer:)init(CVPixelBuffer:options:)init(CVPixelBuffer:options:)init(IOSurface:)init(IOSurface:)init(IOSurface:options:)init(IOSurface:options:)init(IOSurface:plane:format:options:)init(MTLTexture:options:)init(MTLTexture:options:)init(coder:)init(contentsOfURL:)init(contentsOfURL:)init(contentsOfURL:options:)init(contentsOfURL:options:)