Contents

CIImage

A representation of an image to be processed or produced by Core Image filters.

Declaration

class CIImage

Mentioned 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

Creating an Image by Modifying an Existing Image

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

Instance Properties

Instance Methods

Initializers

See Also

Essentials