<!--
{
  "availability" : [
    "iOS: 5.0.0 -",
    "iPadOS: 5.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.4.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreImage",
  "identifier" : "/documentation/CoreImage/CIImage",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Core Image"
    ],
    "preciseIdentifier" : "c:objc(cs)CIImage"
  },
  "title" : "CIImage"
}
-->

# CIImage

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

```
class CIImage
```

## Overview

You use `CIImage` objects in conjunction with other Core Image classes—such as [`CIFilter`](/documentation/CoreImage/CIFilter-swift.class), [`CIContext`](/documentation/CoreImage/CIContext), [`CIVector`](/documentation/CoreImage/CIVector), and [`CIColor`](/documentation/CoreImage/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 (<doc://com.apple.documentation/documentation/CoreVideo/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 <doc://com.apple.documentation/documentation/UIKit/UIImage> in <doc://com.apple.documentation/documentation/UIKit/UIImageView>:

```objc
NSURL* imageURL = [[NSBundle mainBundle] URLForResource:@"YourJPEGName" withExtension:@"JPG"];
CIImage* ciImage = [CIImage imageWithContentsOfURL:imageURL];
UIImage* uiImage = [UIImage imageWithCIImage:ciImage];
UIImageView* imageView = [[UIImageView alloc] initWithImage:uiImage];
[self.view addSubview:imageView];
```

`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](https://developer.apple.com/library/archive/documentation/GraphicsImaging/Conceptual/CoreImaging/ci_intro/ci_intro.html#//apple_ref/doc/uid/TP30001185).

## Topics

### Creating an Image

[`empty()`](/documentation/CoreImage/CIImage/empty())

Creates and returns an empty image object.

[`init(image:)`](/documentation/CoreImage/CIImage/init(image:))

Initializes an image object with the specified UIKit image object.

[`init(image:options:)`](/documentation/CoreImage/CIImage/init(image:options:))

Initializes an image object with the specified UIKit image object, using the specified options.

[`init(contentsOf:)`](/documentation/CoreImage/CIImage/init(contentsOf:))

Initializes an image object by reading an image from a URL.

[`imageWithContentsOfURL:`](/documentation/CoreImage/CIImage/imageWithContentsOfURL:)

Creates and returns an image object from the contents of a file.

[`init(contentsOf:options:)`](/documentation/CoreImage/CIImage/init(contentsOf:options:))

Initializes an image object by reading an image from a URL, using the specified options.

[`imageWithContentsOfURL:options:`](/documentation/CoreImage/CIImage/imageWithContentsOfURL:options:)

Creates and returns an image object from the contents of a file, using the specified options.

[`imageWithCGImage:`](/documentation/CoreImage/CIImage/imageWithCGImage:)

Creates and returns an image object from a Quartz 2D image.

[`init(cgImage:)`](/documentation/CoreImage/CIImage/init(cgImage:)-2kvvb)

Initializes an image object with a Quartz 2D image.

[`imageWithCGImage:options:`](/documentation/CoreImage/CIImage/imageWithCGImage:options:)

Creates and returns an image object from a Quartz 2D image using the specified options.

[`init(cgImage:options:)`](/documentation/CoreImage/CIImage/init(cgImage:options:)-8663h)

Initializes an image object with a Quartz 2D image, using the specified options.

[`imageWithCGImageSource:index:options:`](/documentation/CoreImage/CIImage/imageWithCGImageSource:index:options:)

[`init(cgImageSource:index:options:)`](/documentation/CoreImage/CIImage/init(cgImageSource:index:options:)-e2bz)

[`imageWithData:`](/documentation/CoreImage/CIImage/imageWithData:)

Creates and returns an image object initialized with the supplied image data.

[`init(data:)`](/documentation/CoreImage/CIImage/init(data:))

Initializes an image object with the supplied image data.

[`imageWithData:options:`](/documentation/CoreImage/CIImage/imageWithData:options:)

Creates and returns an image object initialized with the supplied image data, using the specified options.

[`init(data:options:)`](/documentation/CoreImage/CIImage/init(data:options:))

Initializes an image object with the supplied image data, using the specified options.

[`imageWithBitmapData:bytesPerRow:size:format:colorSpace:`](/documentation/CoreImage/CIImage/imageWithBitmapData:bytesPerRow:size:format:colorSpace:)

Creates and returns an image object from bitmap data.

[`init(bitmapData:bytesPerRow:size:format:colorSpace:)`](/documentation/CoreImage/CIImage/init(bitmapData:bytesPerRow:size:format:colorSpace:))

Initializes an image object with bitmap data.

[`init(bitmapImageRep:)`](/documentation/CoreImage/CIImage/init(bitmapImageRep:))

Initializes an image object with the specified bitmap image representation.

[`imageWithImageProvider:size::format:colorSpace:options:`](/documentation/CoreImage/CIImage/imageWithImageProvider:size::format:colorSpace:options:)

Create an image object based on pixels from an image provider object.

[`init(imageProvider:size:_:format:colorSpace:options:)`](/documentation/CoreImage/CIImage/init(imageProvider:size:_:format:colorSpace:options:))

Initializes an image object based on pixels from an image provider object.

[`imageWithDepthData:`](/documentation/CoreImage/CIImage/imageWithDepthData:)

[`init(depthData:)`](/documentation/CoreImage/CIImage/init(depthData:))

[`imageWithDepthData:options:`](/documentation/CoreImage/CIImage/imageWithDepthData:options:)

[`init(depthData:options:)`](/documentation/CoreImage/CIImage/init(depthData:options:))

[`imageWithPortaitEffectsMatte:`](/documentation/CoreImage/CIImage/imageWithPortaitEffectsMatte:)

[`init(portaitEffectsMatte:)`](/documentation/CoreImage/CIImage/init(portaitEffectsMatte:))

[`imageWithPortaitEffectsMatte:options:`](/documentation/CoreImage/CIImage/imageWithPortaitEffectsMatte:options:)

[`init(portaitEffectsMatte:options:)`](/documentation/CoreImage/CIImage/init(portaitEffectsMatte:options:))

[`imageWithSemanticSegmentationMatte:`](/documentation/CoreImage/CIImage/imageWithSemanticSegmentationMatte:)

[`init(semanticSegmentationMatte:)`](/documentation/CoreImage/CIImage/init(semanticSegmentationMatte:))

[`imageWithSemanticSegmentationMatte:options:`](/documentation/CoreImage/CIImage/imageWithSemanticSegmentationMatte:options:)

[`init(semanticSegmentationMatte:options:)`](/documentation/CoreImage/CIImage/init(semanticSegmentationMatte:options:))

[`imageWithCVImageBuffer:`](/documentation/CoreImage/CIImage/imageWithCVImageBuffer:)

Creates and returns an image object from the contents of  `CVImageBuffer` object.

[`init(cvImageBuffer:)`](/documentation/CoreImage/CIImage/init(cvImageBuffer:)-7wmzq)

Initializes an image object from the contents of a Core Video image buffer.

[`imageWithCVImageBuffer:options:`](/documentation/CoreImage/CIImage/imageWithCVImageBuffer:options:)

Creates and returns an image object from the contents of  `CVImageBuffer` object, using the specified options.

[`init(cvImageBuffer:options:)`](/documentation/CoreImage/CIImage/init(cvImageBuffer:options:)-8upim)

Initializes an image object from the contents of a Core Video image buffer, using the specified options.

[`imageWithCVPixelBuffer:`](/documentation/CoreImage/CIImage/imageWithCVPixelBuffer:)

Creates and returns an image object from the contents of  `CVPixelBuffer` object.

[`init(cvPixelBuffer:)`](/documentation/CoreImage/CIImage/init(cvPixelBuffer:)-3wng7)

Initializes an image object from the contents of a Core Video pixel buffer.

[`imageWithCVPixelBuffer:options:`](/documentation/CoreImage/CIImage/imageWithCVPixelBuffer:options:)

Creates and returns an image object from the contents of  `CVPixelBuffer` object, using the specified options.

[`init(cvPixelBuffer:options:)`](/documentation/CoreImage/CIImage/init(cvPixelBuffer:options:)-9x2pz)

Initializes an image object from the contents of a Core Video pixel buffer using the specified options.

[`imageWithMTLTexture:options:`](/documentation/CoreImage/CIImage/imageWithMTLTexture:options:)

Creates and returns an image object with data supplied by a Metal texture.

[`init(mtlTexture:options:)`](/documentation/CoreImage/CIImage/init(mtlTexture:options:)-67uvj)

Initializes an image object with data supplied by a Metal texture.

[`imageWithIOSurface:`](/documentation/CoreImage/CIImage/imageWithIOSurface:)

Creates and returns an image from the contents of an IOSurface.

[`init(ioSurface:)`](/documentation/CoreImage/CIImage/init(ioSurface:)-5e9yc)

Initializes an image with the contents of an IOSurface.

[`init(ioSurface:options:)`](/documentation/CoreImage/CIImage/init(ioSurface:options:)-48cta)

Initializes, using the specified options, an image with the contents of an IOSurface.

### Creating an Image by Modifying an Existing Image

[`applyingFilter(_:parameters:)`](/documentation/CoreImage/CIImage/applyingFilter(_:parameters:))

Returns a new image created by applying a filter to the original image with the specified name and parameters.

[`applyingFilter(_:)`](/documentation/CoreImage/CIImage/applyingFilter(_:))

Applies the filter to an image and returns the output.

[`transformed(by:)`](/documentation/CoreImage/CIImage/transformed(by:))

Returns a new image that represents the original image after applying an affine transform.

[`transformed(by:highQualityDownsample:)`](/documentation/CoreImage/CIImage/transformed(by:highQualityDownsample:))

[`cropped(to:)`](/documentation/CoreImage/CIImage/cropped(to:))

Returns a new image with a cropped portion of the original image.

[`oriented(forExifOrientation:)`](/documentation/CoreImage/CIImage/oriented(forExifOrientation:))

Returns a new image created by transforming the original image to the specified EXIF orientation.

[`clampedToExtent()`](/documentation/CoreImage/CIImage/clampedToExtent())

Returns a new image created by making the pixel colors along its edges extend infinitely in all directions.

[`clamped(to:)`](/documentation/CoreImage/CIImage/clamped(to:))

Returns a new image created by cropping to a specified area, then making the pixel colors along the edges of the cropped image extend infinitely in all directions.

[`composited(over:)`](/documentation/CoreImage/CIImage/composited(over:))

Returns a new image created by compositing the original image over the specified destination image.

[`convertingWorkingSpaceToLab()`](/documentation/CoreImage/CIImage/convertingWorkingSpaceToLab())

[`convertingLabToWorkingSpace()`](/documentation/CoreImage/CIImage/convertingLabToWorkingSpace())

[`matchedToWorkingSpace(from:)`](/documentation/CoreImage/CIImage/matchedToWorkingSpace(from:))

Returns a new image created by color matching from the specified color space to the context’s working color space.

[`matchedFromWorkingSpace(to:)`](/documentation/CoreImage/CIImage/matchedFromWorkingSpace(to:))

Returns a new image created by color matching from the context’s working color space to the specified color space.

[`premultiplyingAlpha()`](/documentation/CoreImage/CIImage/premultiplyingAlpha())

Returns a new image created by multiplying the image’s RGB values by its alpha values.

[`unpremultiplyingAlpha()`](/documentation/CoreImage/CIImage/unpremultiplyingAlpha())

Returns a new image created by dividing the image’s RGB values by its alpha values.

[`settingAlphaOne(in:)`](/documentation/CoreImage/CIImage/settingAlphaOne(in:))

Returns a new image created by setting all alpha values to 1.0 within the specified rectangle and to 0.0 outside of that area.

[`applyingGaussianBlur(sigma:)`](/documentation/CoreImage/CIImage/applyingGaussianBlur(sigma:))

Create an image by applying a gaussian blur to the receiver.

[`settingProperties(_:)`](/documentation/CoreImage/CIImage/settingProperties(_:))

Return a new image by changing the receiver’s metadata properties.

[`insertingIntermediate()`](/documentation/CoreImage/CIImage/insertingIntermediate())

Create an image that inserts a intermediate that is cacheable

[`insertingIntermediate(cache:)`](/documentation/CoreImage/CIImage/insertingIntermediate(cache:))

Create an image that inserts a intermediate that is cacheable.

### Creating Solid Colors

[`init(color:)`](/documentation/CoreImage/CIImage/init(color:))

Initializes an image of infinite extent whose entire content is the specified color.

[`imageWithColor:`](/documentation/CoreImage/CIImage/imageWithColor:)

Creates and returns an image of infinite extent whose entire content is the specified color.

[`black`](/documentation/CoreImage/CIImage/black)

[`blue`](/documentation/CoreImage/CIImage/blue)

[`clear`](/documentation/CoreImage/CIImage/clear)

[`cyan`](/documentation/CoreImage/CIImage/cyan)

[`gray`](/documentation/CoreImage/CIImage/gray)

[`green`](/documentation/CoreImage/CIImage/green)

[`magenta`](/documentation/CoreImage/CIImage/magenta)

[`red`](/documentation/CoreImage/CIImage/red)

[`white`](/documentation/CoreImage/CIImage/white)

[`yellow`](/documentation/CoreImage/CIImage/yellow)

### Getting Image Information

[`definition`](/documentation/CoreImage/CIImage/definition)

Returns a filter shape object that represents the domain of definition of the image.

[`extent`](/documentation/CoreImage/CIImage/extent)

A rectangle that specifies the extent of the image.

[`properties`](/documentation/CoreImage/CIImage/properties)

Returns the metadata properties dictionary of the image.

[`url`](/documentation/CoreImage/CIImage/url)

The URL from which the image was loaded.

[`colorSpace`](/documentation/CoreImage/CIImage/colorSpace)

The color space of the image.

[`orientationTransform(forExifOrientation:)`](/documentation/CoreImage/CIImage/orientationTransform(forExifOrientation:))

Returns the transformation needed to reorient the image to the specified orientation.

### Drawing Images

[`draw(at:from:operation:fraction:)`](/documentation/CoreImage/CIImage/draw(at:from:operation:fraction:))

Draws all or part of the image at the specified point in the current coordinate system.

[`draw(in:from:operation:fraction:)`](/documentation/CoreImage/CIImage/draw(in:from:operation:fraction:))

Draws all or part of the image in the specified rectangle in the current coordinate system

### Getting Autoadjustment Filters

[`autoAdjustmentFilters()`](/documentation/CoreImage/CIImage/autoAdjustmentFilters())

Returns all possible automatically selected and configured filters for adjusting the image.

[`autoAdjustmentFilters(options:)`](/documentation/CoreImage/CIImage/autoAdjustmentFilters(options:))

Returns a subset of automatically selected and configured filters for adjusting the image.

[Autoadjustment Keys](/documentation/CoreImage/autoadjustment-keys)

Constants used as keys in the options dictionary for the [`autoAdjustmentFilters(options:)`](/documentation/CoreImage/CIImage/autoAdjustmentFilters(options:)) method.

### Working with Filter Regions of Interest

[`regionOfInterest(for:in:)`](/documentation/CoreImage/CIImage/regionOfInterest(for:in:))

Returns the region of interest for the filter chain that generates the image.

### Working with Orientation

[`oriented(_:)`](/documentation/CoreImage/CIImage/oriented(_:))

Transforms the original image by a given orientation.

[`orientationTransform(for:)`](/documentation/CoreImage/CIImage/orientationTransform(for:))

The affine transform for changing the image to the given orientation.

### Sampling the Image

[`samplingNearest()`](/documentation/CoreImage/CIImage/samplingNearest())

Create an image by changing the receiver’s sample mode to nearest neighbor.

[`samplingLinear()`](/documentation/CoreImage/CIImage/samplingLinear())

Create an image by changing the receiver’s sample mode to bilinear interpolation.

### Accessing Original Image Content

[`cgImage`](/documentation/CoreImage/CIImage/cgImage)

The CoreGraphics image object this image was created from, if applicable.

[`pixelBuffer`](/documentation/CoreImage/CIImage/pixelBuffer)

The CoreVideo pixel buffer this image was created from, if applicable.

[`depthData`](/documentation/CoreImage/CIImage/depthData)

Depth data associated with the image.

[`portraitEffectsMatte`](/documentation/CoreImage/CIImage/portraitEffectsMatte)

The portrait effects matte associated with the image.

[`semanticSegmentationMatte`](/documentation/CoreImage/CIImage/semanticSegmentationMatte)

### Image Dictionary Keys

Constants used as keys in the options dictionary when initializing an image.

[`CIImageOption`](/documentation/CoreImage/CIImageOption)

### AutoAdjustment Keys

Constants used as keys in the options dictionary for the [`autoAdjustmentFilters(options:)`](/documentation/CoreImage/CIImage/autoAdjustmentFilters(options:))

Returns a subset of automatically selected and configured filters for adjusting the image. method.

[`CIImageAutoAdjustmentOption`](/documentation/CoreImage/CIImageAutoAdjustmentOption)

### Deprecated

[`imageWithCGLayer:`](/documentation/CoreImage/CIImage/imageWithCGLayer:)

Creates and returns an image object from the contents supplied by a `CGLayer` object.

[`imageWithCGLayer:options:`](/documentation/CoreImage/CIImage/imageWithCGLayer:options:)

Creates and returns an image object  from the contents supplied by a `CGLayer` object, using the  specified options.

[`init(cgLayer:)`](/documentation/CoreImage/CIImage/init(cgLayer:)-2lgo6)

Initializes an image object  from the contents supplied by a CGLayer object.

[`init(cgLayer:options:)`](/documentation/CoreImage/CIImage/init(cgLayer:options:)-3p3l3)

Initializes an image object  from the contents supplied by a CGLayer object, using the  specified options.

[`imageWithTexture:size:flipped:colorSpace:`](/documentation/CoreImage/CIImage/imageWithTexture:size:flipped:colorSpace:)

Creates and returns an image object initialized with data supplied by an OpenGL texture.

[`imageWithTexture:size:flipped:options:`](/documentation/CoreImage/CIImage/imageWithTexture:size:flipped:options:)

Creates and returns an image object initialized with data supplied by an OpenGL texture.

[`init(texture:size:flipped:colorSpace:)`](/documentation/CoreImage/CIImage/init(texture:size:flipped:colorSpace:))

Initializes an image object with data supplied by an OpenGL texture.

[`init(texture:size:flipped:options:)`](/documentation/CoreImage/CIImage/init(texture:size:flipped:options:))

Initializes an image object with data supplied by an OpenGL texture.

[`imageWithIOSurface:options:`](/documentation/CoreImage/CIImage/imageWithIOSurface:options:)

Creates, using the specified options, and returns an image from the contents of an IOSurface.

[`init(ioSurface:plane:format:options:)`](/documentation/CoreImage/CIImage/init(ioSurface:plane:format:options:)-93isn)

Initializes, using the specified format and options, an image with the contents of a specific data plane in an IOSurface.

[`textureTarget`](/documentation/CoreImage/CIImageOption/textureTarget)

The key for an OpenGL texture target.

[`textureFormat`](/documentation/CoreImage/CIImageOption/textureFormat)

The key for an OpenGL texture format.

### Instance Properties

[`contentHeadroom`](/documentation/CoreImage/CIImage/contentHeadroom)

Returns the content headroom of the image.

[`isOpaque`](/documentation/CoreImage/CIImage/isOpaque)

Returns YES if the image is known to have and alpha value of `1.0` over the entire image extent.

[`metalTexture`](/documentation/CoreImage/CIImage/metalTexture)

### Instance Methods

[`applyingGainMap(_:)`](/documentation/CoreImage/CIImage/applyingGainMap(_:))

Create an image that applies a gain map Core Image image to the received Core Image image.

[`applyingGainMap(_:headroom:)`](/documentation/CoreImage/CIImage/applyingGainMap(_:headroom:))

Create an image that applies a gain map Core Image image with a specified headroom to the received Core Image image.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)