<!--
{
  "availability" : [
    "macOS: 10.5.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreImage",
  "identifier" : "/documentation/CoreImage/CIFilterGenerator",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Core Image"
    ],
    "preciseIdentifier" : "c:objc(cs)CIFilterGenerator"
  },
  "title" : "CIFilterGenerator"
}
-->

# CIFilterGenerator

An object that creates and configures chains of individual image filters.

```
class CIFilterGenerator
```

## Overview

The `CIFilterGenerator` class provides methods for creating a [`CIFilter`](/documentation/CoreImage/CIFilter-swift.class) object by chaining together existing `CIFilter` objects to create complex effects. (A **filter chain** refers to the `CIFilter` objects that are connected in the `CIFilterGenerator` object.) The complex effect can be encapsulated as a [`CIFilterGenerator`](/documentation/CoreImage/CIFilterGenerator) object and saved as a file so that it can be used again. The **filter generator file** contains an archived instance  of all the `CIFilter` objects that are chained together.

Any filter generator files that you copy to `/Library/Graphics/Image Units/` are loaded when any of the loading methods provided by the [`CIPlugIn`](/documentation/CoreImage/CIPlugIn) class are invoked. A `CIFilterGenerator` object is registered by its filename or, if present, by a class attribute that you supply in its description.

You can create a  `CIFilterGenerator` object  programmatically, using the methods provided by the `CIFilterGenerator` class, or by using the editor view provided by Core Image.

## Topics

### Creating Filter Generator Objects

[`+  filterGenerator`](/documentation/CoreImage/CIFilterGenerator/filterGenerator)

Creates and returns an empty filter generator object.

[`+  filterGeneratorWithContentsOfURL:`](/documentation/CoreImage/CIFilterGenerator/filterGeneratorWithContentsOfURL:)

Creates and returns a filter generator object and initializes it with the contents of a filter generator file.

### Initializing a Filter Generator Object

[`-  initWithContentsOfURL:`](/documentation/CoreImage/CIFilterGenerator/init(contentsOf:))

Initializes a filter generator object with the contents of a filter generator file.

### Connecting and Disconnecting Objects

[`-  connectObject:withKey:toObject:withKey:`](/documentation/CoreImage/CIFilterGenerator/connect(_:withKey:to:withKey:))

Adds an object to the filter chain.

[`-  disconnectObject:withKey:toObject:withKey:`](/documentation/CoreImage/CIFilterGenerator/disconnectObject(_:withKey:to:withKey:))

Removes the connection between two objects in the filter chain.

### Managing Exported Keys

[`exportedKeys`](/documentation/CoreImage/CIFilterGenerator/exportedKeys)

Returns an array of the exported keys.

[`-  exportKey:fromObject:withName:`](/documentation/CoreImage/CIFilterGenerator/exportKey(_:from:withName:))

Exports an input or output key of an object in the filter chain.

[`-  removeExportedKey:`](/documentation/CoreImage/CIFilterGenerator/removeExportedKey(_:))

Removes a key that was previously exported.

[`-  setAttributes:forExportedKey:`](/documentation/CoreImage/CIFilterGenerator/setAttributes(_:forExportedKey:))

Sets a dictionary of attributes for an exported key.

### Setting and Getting Class Attributes

[`classAttributes`](/documentation/CoreImage/CIFilterGenerator/classAttributes)

The class attributes associated with the filter.

### Archiving a Filter Generator Object

[`-  writeToURL:atomically:`](/documentation/CoreImage/CIFilterGenerator/write(to:atomically:))

Archives a filter generator object to a filter generator file.

### Registering a Filter Chain

[`-  registerFilterName:`](/documentation/CoreImage/CIFilterGenerator/registerFilterName(_:))

Registers the name associated with a filter chain.

### Creating a Filter from a Filter Chain

[`-  filter`](/documentation/CoreImage/CIFilterGenerator/filter())

Creates a filter object based on the filter chain.

### Constants

[Exported Keys](/documentation/CoreImage/exported-keys)

Keys for the exported parameters of a filter generator object.

## Relationships

### Conforms To

[`Hashable`](/documentation/Swift/Hashable)

[`CVarArg`](/documentation/Swift/CVarArg)

[`NSCopying`](/documentation/Foundation/NSCopying)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

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

[`Equatable`](/documentation/Swift/Equatable)

[`NSCoding`](/documentation/Foundation/NSCoding)

[`NSSecureCoding`](/documentation/Foundation/NSSecureCoding)

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

---

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)