iOS Developer Library — Prerelease

Developer

Core Image Reference Collection CIFilter Class Reference

Options
Deployment Target:

On This Page
Language:

CIFilter

The CIFilter class produces a CIImage object as output. Typically, a filter takes one or more images as input. Some filters, however, generate an image based on other types of input parameters. The parameters of a CIFilter object are set and retrieved through the use of key-value pairs.

You use the CIFilter object in conjunction with other Core Image classes, such as CIImage, CIContext, and CIColor, to take advantage of the built-in Core Image filters when processing images, creating filter generators, or writing custom filters.

CIFilter objects, are not mutable. A CIFilter object cannot be shared safely among threads. If you app is multithreaded, each thread must create its own CIFilter object. Otherwise, your app could behave unexpectedly.

To get a quick overview of how to set up and use Core Image filters, see Core Image Programming Guide.

Subclassing Notes

You can subclass CIFilter in order to create custom filter effects:

  • By chaining together two or more built-in Core Image filters (iOS and OS X)

  • By using an image-processing kernel that you write (OS X only)

See Core Image Programming Guide for details.

Methods to Override

Regardless of whether your subclass provides its effect by chaining filters or implementing its own kernel, you should:

  • Declare any input parameters as properties whose names are prefixed with input, such as inputImage.

  • Override the setDefaults methods to provide default values for any input parameters you’ve declared.

  • Implement an outputImage method to create a new CIImage with your filter’s effect.

Special Considerations

The CIFilter class automatically manages input parameters when archiving, copying, and deallocating filters. For this reason, your subclass must obey the following guidelines to ensure proper behavior:

  • Store input parameters in instance variables whose names are prefixed with input.

    Don’t use auto-synthesized instance variables, because their names are automatically prefixed with an underscore. Instead, synthesize the property manually. For example:

    @synthesize inputMyParameter;

  • If using manual reference counting, don’t release input parameter instance variables in your dealloc method implementation. The dealloc implementation in the CIFilter class uses key-value coding to automatically sets the values of all input parameters to nil.

  • Creates a CIFilter object for a specific kind of filter.

    Declaration

    Swift

    init?(name name: String)

    Objective-C

    + (CIFilter * nullable)filterWithName:(NSString * nonnull)name

    Parameters

    name

    The name of the filter. You must make sure the name is spelled correctly, otherwise your app will run but not produce any output images. For that reason, you should check for the existence of the filter after calling this method.

    Return Value

    A CIFilter object whose input values are undefined.

    Discussion

    In OS X, after creating a filter with this method you must call setDefaults or set parameters individually by calling setValue:forKey:. In iOS, the filter’s parameters are automatically set to default values.

    Availability

    Available in iOS 5.0 and later.

  • Creates a CIFilter object for a specific kind of filter and initializes the input values.

    Declaration

    Swift

    init?(name name: String, withInputParameters params: [String : AnyObject]?)

    Objective-C

    + (CIFilter * nullable)filterWithName:(NSString * nonnull)name withInputParameters:(NSDictionary<NSString *,id> * nullable)params

    Parameters

    name

    The name of the filter. You must make sure the name is spelled correctly, otherwise your app will run but not produce any output images. For that reason, you should check for the existence of the filter after calling this method.

    params

    A list of key-value pairs to set as input values to the filter. Each key is a constant that specifies the name of an input parameter for the filter, and the corresponding value is the value for that parameter. See Core Image Filter Reference for built-in filters and their allowed parameters.

    Return Value

    A CIFilter object whose input values are initialized.

    Discussion

    Use this method to quickly create and configure a CIFilter instance, as in the example below.

    1. CIFilter *f = [CIFilter filterWithName: @"CIColorControls"
    2. withInputParameters: @{
    3. @"inputImage" : inImage,
    4. @"inputSaturation" : @0.5,
    5. @"inputBrightness" : @1.2,
    6. @"inputContrast" : @1.3
    7. }];

    Availability

    Available in iOS 8.0 and later.

  • Creates a CIFilter object for a specific kind of filter and initializes the input values with a nil-terminated list of arguments.

    Declaration

    Objective-C

    + (CIFilter * nullable)filterWithName:(NSString * nonnull)name keysAndValues:(id)key0, ...

    Parameters

    name

    The name of the filter. You must make sure the name is spelled correctly, otherwise your app will run but not produce any output images. For that reason, you should check for the existence of the filter after calling this method.

    key0,...

    A list of key-value pairs to set as input values to the filter. Each key is a constant that specifies the name of the input value to set, and must be followed by a value. You signal the end of the list by passing a nil value.

    Return Value

    A CIFilter object whose input values are initialized.

    Discussion

    As with all Objective-C methods that accept nil-terminated argument lists, to prevent unintended behavior you must take take care not to pass a nil value before the intended end of the argument list. You can avoid such issues by using the filterWithName:withInputParameters: method to create a filter, expressing the parameter list as a dictionary literal.

    Availability

    Available in iOS 5.0 and later.

  • Returns an array of all published filter names that match all the specified categories.

    Declaration

    Swift

    class func filterNamesInCategories(_ categories: [String]?) -> [String]

    Objective-C

    + (NSArray<NSString *> * nonnull)filterNamesInCategories:(NSArray<NSString *> * nullable)categories

    Parameters

    categories

    One or more of the filter category keys defined in Filter Category Keys. Pass nil to get all filters in all categories.

    Return Value

    An array that contains all published filter names that match all the categories specified by the categories argument.

    Discussion

    When you pass more than one filter category, this method returns the intersection of the filters in the categories. For example, if you pass the categories kCICategoryBuiltIn and kCICategoryColorAdjustment, you obtain all the filters that are members of both the built-in and color adjustment categories. But if you pass in kCICategoryGenerator and kCICategoryStylize, you will not get any filters returned to you because there are no filters that are members of both the generator and stylize categories. If you want to obtain all stylize and generator filters, you must call the filterNamesInCategories: method for each category separately and then merge the results.

    Availability

    Available in iOS 5.0 and later.

  • Returns an array of all published filter names in the specified category.

    Declaration

    Swift

    class func filterNamesInCategory(_ category: String?) -> [String]

    Objective-C

    + (NSArray<NSString *> * nonnull)filterNamesInCategory:(NSString * nullable)category

    Parameters

    category

    A string object that specifies one of the filter categories defined in Filter Category Keys.

    Return Value

    An array that contains all published names of the filter in a category.

    Availability

    Available in iOS 5.0 and later.

  • Publishes a custom filter that is not packaged as an image unit.

    Declaration

    Swift

    class func registerFilterName(_ name: String, constructor anObject: CIFilterConstructor, classAttributes attributes: [String : AnyObject])

    Objective-C

    + (void)registerFilterName:(NSString * nonnull)name constructor:(id<CIFilterConstructor> nonnull)anObject classAttributes:(NSDictionary<NSString *,id> * nonnull)attributes

    Parameters

    name

    A string object that specifies the name of the filter you want to publish.

    anObject

    A constructor object that implements the filterWithName method.

    attributes

    A dictionary that contains the class display name and filter categories attributes along with the appropriate value for each attributes. That is, the kCIAttributeFilterDisplayName attribute and a string that specifies the display name, and the kCIAttributeFilterCategories and an array that specifies the categories to which the filter belongs (such as kCICategoryStillImage and kCICategoryDistortionEffect). All other attributes for the filter should be returned by the custom attributes method implement by the filter.

    Discussion

    In most cases you don’t need to use this method because the preferred way to register a custom filter that you write is to package it as an image unit. You do not need to use this method for a filter packaged as an image unit because you register your filter using the CIPlugInRegistration protocol. (See Core Image Programming Guide for additional details.)

    Availability

    Available in iOS 9.0 and later.

  • name name Property

    A name associated with a filter.

    Declaration

    Swift

    var name: String { get }

    Objective-C

    @property(nonatomic, readonly) NSString *name

    Discussion

    You use a filter’s name to construct key paths to its attributes when the filter is attached to a Core Animation layer. For example, if a CALayer object has an attached CIFilter instance whose name is myExposureFilter, you can refer to attributes of the filter using a key path such as filters.myExposureFilter.inputEV. Layer animations may also access filter attributes via these key paths.

    The default value for this property is nil.

    Availability

    Available in iOS 5.0 and later.

  • Returns a dictionary of key-value pairs that describe the filter.

    Declaration

    Swift

    var attributes: [String : AnyObject] { get }

    Objective-C

    @property(nonatomic, readonly) NSDictionary<NSString *,id> *attributes

    Return Value

    A dictionary that contains a key for each input and output parameter for the filter. Each key is a dictionary that contains all the attributes of an input or output parameter.

    Discussion

    For example, the attributes dictionary for the CIColorControls filter contains the following information:

    1. CIColorControls:
    2. {
    3. CIAttributeFilterCategories = (
    4. CICategoryColorAdjustment,
    5. CICategoryVideo,
    6. CICategoryStillImage,
    7. CICategoryInterlaced,
    8. CICategoryNonSquarePixels,
    9. CICategoryBuiltIn
    10. );
    11. CIAttributeFilterDisplayName = "Color Controls";
    12. CIAttributeFilterName = CIColorControls;
    13. inputBrightness = {
    14. CIAttributeClass = NSNumber;
    15. CIAttributeDefault = 0;
    16. CIAttributeIdentity = 0;
    17. CIAttributeMin = -1;
    18. CIAttributeSliderMax = 1;
    19. CIAttributeSliderMin = -1;
    20. CIAttributeType = CIAttributeTypeScalar;
    21. };
    22. inputContrast = {
    23. CIAttributeClass = NSNumber;
    24. CIAttributeDefault = 1;
    25. CIAttributeIdentity = 1;
    26. CIAttributeMin = 0.25;
    27. CIAttributeSliderMax = 4;
    28. CIAttributeSliderMin = 0.25;
    29. CIAttributeType = CIAttributeTypeScalar;
    30. };
    31. inputImage = {CIAttributeClass = CIImage; };
    32. inputSaturation = {
    33. CIAttributeClass = NSNumber;
    34. CIAttributeDefault = 1;
    35. CIAttributeIdentity = 1;
    36. CIAttributeMin = 0;
    37. CIAttributeSliderMax = 3;
    38. CIAttributeSliderMin = 0;
    39. CIAttributeType = CIAttributeTypeScalar;
    40. };
    41. outputImage = {CIAttributeClass = CIImage; };
    42. }

    Availability

    Available in iOS 5.0 and later.

  • Returns an array that contains the names of the input parameters to the filter.

    Declaration

    Swift

    var inputKeys: [String] { get }

    Objective-C

    @property(nonatomic, readonly) NSArray<NSString *> *inputKeys

    Return Value

    An array that contains the names of all input parameters to the filter.

    Availability

    Available in iOS 5.0 and later.

  • Returns an array that contains the names of the output parameters for the filter.

    Declaration

    Swift

    var outputKeys: [String] { get }

    Objective-C

    @property(nonatomic, readonly) NSArray<NSString *> *outputKeys

    Return Value

    An array that contains the names of all output parameters from the filter.

    Availability

    Available in iOS 5.0 and later.

  • Returns a CIImage object that encapsulates the operations configured in the filter. (read-only)

    Declaration

    Swift

    var outputImage: CIImage { get }

    Objective-C

    @property(readonly, nonatomic) CIImage *outputImage

    Availability

    Available in iOS 5.0 and later.

  • Sets all input values for a filter to default values.

    Declaration

    Swift

    func setDefaults()

    Objective-C

    - (void)setDefaults

    Discussion

    Input values whose default values are not defined are left unchanged.

    Availability

    Available in iOS 5.0 and later.

  • Returns the localized name for the specified filter name.

    Declaration

    Swift

    class func localizedNameForFilterName(_ filterName: String) -> String?

    Objective-C

    + (NSString * nullable)localizedNameForFilterName:(NSString * nonnull)filterName

    Parameters

    filterName

    A filter name.

    Return Value

    The localized name for the filter.

    Availability

    Available in iOS 9.0 and later.

  • Returns the localized name for the specified filter category.

    Declaration

    Swift

    class func localizedNameForCategory(_ category: String) -> String

    Objective-C

    + (NSString * nonnull)localizedNameForCategory:(NSString * nonnull)category

    Parameters

    category

    A filter category.

    Return Value

    The localized name for the filter category.

    Availability

    Available in iOS 9.0 and later.

  • Returns the localized description of a filter for display in the user interface.

    Declaration

    Swift

    class func localizedDescriptionForFilterName(_ filterName: String) -> String?

    Objective-C

    + (NSString * nullable)localizedDescriptionForFilterName:(NSString * nonnull)filterName

    Parameters

    filterName

    The filter name.

    Return Value

    The localized description of the filter.

    Availability

    Available in iOS 9.0 and later.

  • Returns the location of the localized reference documentation that describes the filter.

    Declaration

    Swift

    class func localizedReferenceDocumentationForFilterName(_ filterName: String) -> NSURL?

    Objective-C

    + (NSURL * nullable)localizedReferenceDocumentationForFilterName:(NSString * nonnull)filterName

    Parameters

    filterName

    The filter name.

    Return Value

    A URL that specifies the location of the localized documentation, or nil if the filter does not provide localized reference documentation.

    Discussion

    The URL can be a local file or a remote document on a web server. Because filters created prior to OS X v10.5 could return nil, you should be make sure that your code handles this case gracefully.

    Availability

    Available in iOS 9.0 and later.

  • Serializes filter parameters into XMP form that is suitable for embedding in an image.

    Declaration

    Swift

    class func serializedXMPFromFilters(_ filters: [CIFilter], inputImageExtent extent: CGRect) -> NSData

    Objective-C

    + (NSData * nonnull)serializedXMPFromFilters:(NSArray<CIFilter *> * nonnull)filters inputImageExtent:(CGRect)extent

    Parameters

    filters

    The array of filters to serialize. See Discussion for the filters that can be serialized.

    extent

    The extent of the input image to the filter.

    Discussion

    At this time the only filters classes that can be serialized using this method are, CIAffineTransform, CICrop, and the filters returned by the CIImage methods autoAdjustmentFilters and autoAdjustmentFiltersWithOptions:. The parameters of other filter classes will not be serialized.

    Availability

    Available in iOS 6.0 and later.

  • Returns an array of filter objects de-serialized from XMP data.

    Declaration

    Swift

    class func filterArrayFromSerializedXMP(_ xmpData: NSData, inputImageExtent extent: CGRect, error outError: NSErrorPointer) -> [CIFilter]

    Objective-C

    + (NSArray<CIFilter *> * nonnull)filterArrayFromSerializedXMP:(NSData * nonnull)xmpData inputImageExtent:(CGRect)extent error:(NSError * nullable * nullable)outError

    Parameters

    xmpData

    The XMP data created previously by calling serializedXMPFromFilters:inputImageExtent:.

    extent

    The extent of the image from which the XMP data was extracted.

    outError

    The address of an NSError object for receiving errors, otherwise nil.

    Availability

    Available in iOS 6.0 and later.

  • Attributes for a filter and its parameters.

    Declaration

    Swift

    let kCIAttributeFilterName: String let kCIAttributeFilterDisplayName: String let kCIAttributeDescription: String let kCIAttributeReferenceDocumentation: String let kCIAttributeFilterCategories: String let kCIAttributeClass: String let kCIAttributeType: String let kCIAttributeMin: String let kCIAttributeMax: String let kCIAttributeSliderMin: String let kCIAttributeSliderMax: String let kCIAttributeDefault: String let kCIAttributeIdentity: String let kCIAttributeName: String let kCIAttributeDisplayName: String

    Objective-C

    NSString *kCIAttributeFilterName; NSString *kCIAttributeFilterDisplayName; NSString *kCIAttributeDescription; NSString *kCIAttributeReferenceDocumentation; NSString *kCIAttributeFilterCategories; NSString *kCIAttributeClass; NSString *kCIAttributeType; NSString *kCIAttributeMin; NSString *kCIAttributeMax; NSString *kCIAttributeSliderMin; NSString *kCIAttributeSliderMax; NSString *kCIAttributeDefault; NSString *kCIAttributeIdentity; NSString *kCIAttributeName; NSString *kCIAttributeDisplayName;

    Constants

    • kCIAttributeFilterName

      kCIAttributeFilterName

      The filter name, specified as an NSString object.

      Available in iOS 5.0 and later.

    • kCIAttributeFilterDisplayName

      kCIAttributeFilterDisplayName

      The localized version of the filter name that is displayed in the user interface.

      Available in iOS 5.0 and later.

    • kCIAttributeDescription

      kCIAttributeDescription

      The localized description of the filter. This description should inform the end user what the filter does and be short enough to display in the user interface for the filter. It is not intended to be technically detailed.

      Available in iOS 9.0 and later.

    • kCIAttributeReferenceDocumentation

      kCIAttributeReferenceDocumentation

      The localized reference documentation for the filter. The reference should provide developers with technical details.

      Available in iOS 9.0 and later.

    • kCIAttributeFilterCategories

      kCIAttributeFilterCategories

      An array of filter category keys that specifies all the categories in which the filter is a member.

      Available in iOS 5.0 and later.

    • kCIAttributeClass

      kCIAttributeClass

      The class name of the filter.

      Available in iOS 5.0 and later.

    • kCIAttributeType

      kCIAttributeType

      One of the attribute types described in Data Type Attributes.

      Available in iOS 5.0 and later.

    • kCIAttributeMin

      kCIAttributeMin

      The minimum value for a filter parameter, specified as a floating-point value.

      Available in iOS 5.0 and later.

    • kCIAttributeMax

      kCIAttributeMax

      The maximum value for a filter parameter, specified as a floating-point value.

      Available in iOS 5.0 and later.

    • kCIAttributeSliderMin

      kCIAttributeSliderMin

      The minimum value, specified as a floating-point value, to use for a slider that controls input values for a filter parameter.

      Available in iOS 5.0 and later.

    • kCIAttributeSliderMax

      kCIAttributeSliderMax

      The maximum value, specified as a floating-point value, to use for a slider that controls input values for a filter parameter.

      Available in iOS 5.0 and later.

    • kCIAttributeDefault

      kCIAttributeDefault

      The default value, specified as a floating-point value, for a filter parameter.

      Available in iOS 5.0 and later.

    • kCIAttributeIdentity

      kCIAttributeIdentity

      If supplied as a value for a parameter, the parameter has no effect on the input image.

      Available in iOS 5.0 and later.

    • kCIAttributeName

      kCIAttributeName

      The name of the attribute.

      Available in iOS 5.0 and later.

    • kCIAttributeDisplayName

      kCIAttributeDisplayName

      The localized display name of the attribute.

      Available in iOS 5.0 and later.

    Discussion

    Attribute keys are used for the attribute dictionary of a filter. Most entries in the attribute dictionary are optional. The attribute kCIAttributeFilterName is mandatory. For a parameter, the attribute kCIAttributeClass is mandatory because it specifies the class name of the filter.

    A parameter of type NSNumber does not necessarily need the attributes kCIAttributeMin and kCIAttributeMax. These attributes are not present when the parameter has no upper or lower bounds. For example, the Gaussian blur filter has a radius parameter with a minimum of 0 but no maximum value to indicate that all nonnegative values are valid.

  • Numeric data types.

    Declaration

    Swift

    let kCIAttributeTypeTime: String let kCIAttributeTypeScalar: String let kCIAttributeTypeDistance: String let kCIAttributeTypeAngle: String let kCIAttributeTypeBoolean: String let kCIAttributeTypeInteger: String let kCIAttributeTypeCount: String

    Objective-C

    NSString *kCIAttributeTypeTime; NSString *kCIAttributeTypeScalar; NSString *kCIAttributeTypeDistance; NSString *kCIAttributeTypeAngle; NSString *kCIAttributeTypeBoolean; NSString *kCIAttributeTypeInteger; NSString *kCIAttributeTypeCount;

    Constants

    • kCIAttributeTypeTime

      kCIAttributeTypeTime

      A parametric time for transitions, specified as a floating-point value in the range of 0.0 to 1.0.

      Available in iOS 5.0 and later.

    • kCIAttributeTypeScalar

      kCIAttributeTypeScalar

      A scalar value.

      Available in iOS 5.0 and later.

    • kCIAttributeTypeDistance

      kCIAttributeTypeDistance

      A distance.

      Available in iOS 5.0 and later.

    • kCIAttributeTypeAngle

      kCIAttributeTypeAngle

      An angle.

      Available in iOS 5.0 and later.

    • kCIAttributeTypeBoolean

      kCIAttributeTypeBoolean

      A Boolean value.

      Available in iOS 5.0 and later.

    • kCIAttributeTypeInteger

      kCIAttributeTypeInteger

      An integer value.

      Available in iOS 5.0 and later.

    • kCIAttributeTypeCount

      kCIAttributeTypeCount

      A positive integer value.

      Available in iOS 5.0 and later.

  • Vector data types.

    Declaration

    Swift

    let kCIAttributeTypePosition: String let kCIAttributeTypeOffset: String let kCIAttributeTypePosition3: String let kCIAttributeTypeRectangle: String

    Objective-C

    NSString *kCIAttributeTypePosition; NSString *kCIAttributeTypeOffset; NSString *kCIAttributeTypePosition3; NSString *kCIAttributeTypeRectangle

    Constants

    • kCIAttributeTypePosition

      kCIAttributeTypePosition

      A two-dimensional location in the working coordinate space. (A 2-element vector type.)

      Available in iOS 5.0 and later.

    • kCIAttributeTypeOffset

      kCIAttributeTypeOffset

      An offset. (A 2-element vector type.)

      Available in iOS 5.0 and later.

    • kCIAttributeTypePosition3

      kCIAttributeTypePosition3

      A three-dimensional location in the working coordinate space. (A 3-element vector type.)

      Available in iOS 5.0 and later.

    • kCIAttributeTypeRectangle

      kCIAttributeTypeRectangle

      A Core Image vector that specifies the x and y values of the rectangle origin, and the width (w) and height (h) of the rectangle. The vector takes the form [x, y, w, h]. (A 4-element vector type.)

      Available in iOS 5.0 and later.

  • Color types.

    Declaration

    Swift

    let kCIAttributeTypeOpaqueColor: String let kCIAttributeTypeGradient: String let kCIAttributeTypeColor: String

    Objective-C

    NSString *kCIAttributeTypeOpaqueColor; NSString *kCIAttributeTypeGradient; NSString *kCIAttributeTypeColor;

    Constants

    • kCIAttributeTypeOpaqueColor

      kCIAttributeTypeOpaqueColor

      A Core Image color (CIColor object) that specifies red, green, and blue component values. Use this key for colors with no alpha component. If the key is not present, Core Image assumes color with alpha.

      Available in iOS 9.0 and later.

    • kCIAttributeTypeGradient

      kCIAttributeTypeGradient

      An n-by-1 gradient image used to describe a color ramp.

      Available in iOS 9.0 and later.

    • kCIAttributeTypeColor

      kCIAttributeTypeColor

      A Core Image color (CIColor object) that specifies red, green, and blue component values.

      Available in iOS 5.0 and later.

  • Image Types

    Declaration

    Swift

    let kCIAttributeTypeImage: String let kCIAttributeTypeTransform: String

    Objective-C

    NSString *kCIAttributeTypeImage; NSString *kCIAttributeTypeTransform;

    Constants

    • kCIAttributeTypeImage

      kCIAttributeTypeImage

      A CIImage object.

      Available in iOS 5.0 and later.

    • kCIAttributeTypeTransform

      kCIAttributeTypeTransform

      An CGAffineTransform is associated with attribute.

      Available in iOS 5.0 and later.

  • Categories of filters.

    Declaration

    Swift

    let kCICategoryDistortionEffect: String let kCICategoryGeometryAdjustment: String let kCICategoryCompositeOperation: String let kCICategoryHalftoneEffect: String let kCICategoryColorAdjustment: String let kCICategoryColorEffect: String let kCICategoryTransition: String let kCICategoryTileEffect: String let kCICategoryGenerator: String let kCICategoryReduction: String let kCICategoryGradient: String let kCICategoryStylize: String let kCICategorySharpen: String let kCICategoryBlur: String let kCICategoryVideo: String let kCICategoryStillImage: String let kCICategoryInterlaced: String let kCICategoryNonSquarePixels: String let kCICategoryHighDynamicRange: String let kCICategoryBuiltIn: String let kCICategoryFilterGenerator: String

    Objective-C

    NSString *kCICategoryDistortionEffect; NSString *kCICategoryGeometryAdjustment; NSString *kCICategoryCompositeOperation; NSString *kCICategoryHalftoneEffect; NSString *kCICategoryColorAdjustment; NSString *kCICategoryColorEffect; NSString *kCICategoryTransition; NSString *kCICategoryTileEffect; NSString *kCICategoryGenerator; NSString *kCICategoryReduction; NSString *kCICategoryGradient; NSString *kCICategoryStylize; NSString *kCICategorySharpen; NSString *kCICategoryBlur; NSString *kCICategoryVideo; NSString *kCICategoryStillImage; NSString *kCICategoryInterlaced; NSString *kCICategoryNonSquarePixels; NSString *kCICategoryHighDynamicRange ; NSString *kCICategoryBuiltIn; NSString *kCICategoryFilterGenerator;

    Constants

    • kCICategoryDistortionEffect

      kCICategoryDistortionEffect

      A filter that reshapes an image by altering its geometry to create a 3D effect. Using distortion filters, you can displace portions of an image, apply lens effects, make a bulge in an image, and perform other operation to achieve an artistic effect.

      Available in iOS 5.0 and later.

    • kCICategoryGeometryAdjustment

      kCICategoryGeometryAdjustment

      A filter that changes the geometry of an image. Some of these filters are used to warp an image to achieve an artistic effects, but these filters can also be used to correct problems in the source image. For example, you can apply an affine transform to straighten an image that is rotated with respect to the horizon.

      Available in iOS 5.0 and later.

    • kCICategoryCompositeOperation

      kCICategoryCompositeOperation

      A filter operates on two image sources, using the color values of one image to operate on the other. Composite filters perform computations such as computing maximum values, minimum values, and multiplying values between input images. You can use compositing filters to add effects to an image, crop an image, and achieve a variety of other effects.

      Available in iOS 5.0 and later.

    • kCICategoryHalftoneEffect

      kCICategoryHalftoneEffect

      A filter that simulates a variety of halftone screens, to mimic the halftone process used in print media. The output of these filters has the familiar “newspaper” look of the various dot patterns. Filters are typically named after the pattern created by the virtual halftone screen, such as circular screen or hatched screen.

      Available in iOS 5.0 and later.

    • kCICategoryColorAdjustment

      kCICategoryColorAdjustment

      A filter that changes color values. Color adjustment filters are used to eliminate color casts, adjust hue, and correct brightness and contrast. Color adjustment filters do not perform color management; ColorSync performs color management. You can use Quartz 2D to specify the color space associated with an image. For more information, see Color Management Overview and Quartz 2D Programming Guide.

      Available in iOS 5.0 and later.

    • kCICategoryColorEffect

      kCICategoryColorEffect

      A filter that modifies the color of an image to achieve an artistic effect. Examples of color effect filters include filters that change a color image to a sepia image or a monochrome image or that produces such effects as posterizing.

      Available in iOS 5.0 and later.

    • kCICategoryTransition

      kCICategoryTransition

      A filter that provides a bridge between two or more images by applying a motion effect that defines how the pixels of a source image yield to that of the destination image.

      Available in iOS 5.0 and later.

    • kCICategoryTileEffect

      kCICategoryTileEffect

      A filter that typically applies an effect to an image and then create smaller versions of the image (tiles), which are then laid out to create a pattern that’s infinite in extent.

      Available in iOS 5.0 and later.

    • kCICategoryGenerator

      kCICategoryGenerator

      A filter that generates a pattern, such as a solid color, a checkerboard, or a star shine. The generated output is typically used as input to another filter.

      Available in iOS 5.0 and later.

    • kCICategoryReduction

      kCICategoryReduction

      A filter that reduces image data. These filters are used to solve image analysis problems.

      Available in iOS 5.0 and later.

    • kCICategoryGradient

      kCICategoryGradient

      A filter that generates a fill whose color varies smoothly. Exactly how color varies depends on the type of gradient—linear, radial, or Gaussian.

      Available in iOS 5.0 and later.

    • kCICategoryStylize

      kCICategoryStylize

      A filter that makes a photographic image look as if it was painted or sketched. These filters are typically used alone or in combination with other filters to achieve artistic effects.

      Available in iOS 5.0 and later.

    • kCICategorySharpen

      kCICategorySharpen

      A filter that sharpens images, increasing the contrast between the edges in an image. Examples of sharpen filters are unsharp mask and sharpen luminance.

      Available in iOS 5.0 and later.

    • kCICategoryBlur

      kCICategoryBlur

      A filter that softens images, decreasing the contrast between the edges in an image. Examples of blur filters are Gaussian blur and zoom blur.

      Available in iOS 5.0 and later.

    • kCICategoryVideo

      kCICategoryVideo

      A filter that works on video images.

      Available in iOS 5.0 and later.

    • kCICategoryStillImage

      kCICategoryStillImage

      A filter that works on still images.

      Available in iOS 5.0 and later.

    • kCICategoryInterlaced

      kCICategoryInterlaced

      A filter that works on interlaced images.

      Available in iOS 5.0 and later.

    • kCICategoryNonSquarePixels

      kCICategoryNonSquarePixels

      A filter that works on non-square pixels.

      Available in iOS 5.0 and later.

    • kCICategoryHighDynamicRange

      kCICategoryHighDynamicRange

      A filter that works on high dynamic range pixels.

      Available in iOS 5.0 and later.

    • kCICategoryBuiltIn

      kCICategoryBuiltIn

      A filter provided by Core Image. This distinguishes built-in filters from plug-in filters.

      Available in iOS 5.0 and later.

    • kCICategoryFilterGenerator

      kCICategoryFilterGenerator

      A filter created by chaining several filters together and then packaged as a CIFilterGenerator object.

      Available in iOS 9.0 and later.

  • Sets of controls for various user scenarios.

    Declaration

    Swift

    let kCIUIParameterSet: String let kCIUISetBasic: String let kCIUISetIntermediate: String let kCIUISetAdvanced: String let kCIUISetDevelopment: String

    Objective-C

    NSString *kCIUIParameterSet; NSString *kCIUISetBasic; NSString *kCIUISetIntermediate; NSString *kCIUISetAdvanced; NSString *kCIUISetDevelopment;

    Constants

    • kCIUIParameterSet

      kCIUIParameterSet

      The set of input parameters to use. The associated value can be kCIUISetBasic, kCIUISetIntermediate, kCIUISetAdvanced, or kCIUISetDevelopment.

      Available in iOS 9.0 and later.

    • kCIUISetBasic

      kCIUISetBasic

      Controls that are appropriate for a basic user scenario, that is, the minimum of settings to control the filter.

      Available in iOS 9.0 and later.

    • kCIUISetIntermediate

      kCIUISetIntermediate

      Controls that are appropriate for an intermediate user scenario.

      Available in iOS 9.0 and later.

    • kCIUISetAdvanced

      kCIUISetAdvanced

      Controls that are appropriate for an advanced user scenario.

      Available in iOS 9.0 and later.

    • kCIUISetDevelopment

      kCIUISetDevelopment

      Controls that should be visible only for development purposes.

      Available in iOS 9.0 and later.

    Discussion

    You can use these constants to specify the controls that you want associated with each user scenario. For example, for a filter that has many input parameters you can choose a small set of input parameters that the typical consumer can control and set the other input parameters to default values. For the same filter, however, you can choose to allow professional customers to control all the input parameters.

  • Keys for input parameters to filters.

    Declaration

    Swift

    let kCIOutputImageKey: String let kCIInputBackgroundImageKey: String let kCIInputImageKey: String let kCIInputTimeKey: String let kCIInputTransformKey: String let kCIInputScaleKey: String let kCIInputAspectRatioKey: String let kCIInputCenterKey: String let kCIInputRadiusKey: String let kCIInputAngleKey: String let kCIInputRefractionKey: String let kCIInputWidthKey: String let kCIInputSharpnessKey: String let kCIInputIntensityKey: String let kCIInputEVKey: String let kCIInputSaturationKey: String let kCIInputColorKey: String let kCIInputBrightnessKey: String let kCIInputContrastKey: String let kCIInputGradientImageKey: String let kCIInputMaskImageKey: String let kCIInputShadingImageKey: String let kCIInputTargetImageKey: String let kCIInputExtentKey: String let kCIInputVersionKey: String

    Objective-C

    NSString *kCIOutputImageKey; NSString *kCIInputBackgroundImageKey; NSString *kCIInputImageKey; NSString *kCIInputTimeKey; NSString *kCIInputTransformKey; NSString *kCIInputScaleKey; NSString *kCIInputAspectRatioKey; NSString *kCIInputCenterKey; NSString *kCIInputRadiusKey; NSString *kCIInputAngleKey; NSString *kCIInputRefractionKey; NSString *kCIInputWidthKey; NSString *kCIInputSharpnessKey; NSString *kCIInputIntensityKey; NSString *kCIInputEVKey; NSString *kCIInputSaturationKey; NSString *kCIInputColorKey; NSString *kCIInputBrightnessKey; NSString *kCIInputContrastKey; NSString *kCIInputGradientImageKey; NSString *kCIInputMaskImageKey; NSString *kCIInputShadingImageKey; NSString *kCIInputTargetImageKey; NSString *kCIInputExtentKey; NSString *kCIInputVersionKey;

    Constants

    • kCIOutputImageKey

      kCIOutputImageKey

      A key for the CIImage object produced by a filter.

      Available in OS X v10.5 and later. Available in iOS 5.0 and later.

    • kCIInputBackgroundImageKey

      kCIInputBackgroundImageKey

      A key for the CIImage object to use as a background image.

      Available in OS X v10.5 and later. Available in iOS 5.0 and later.

    • kCIInputImageKey

      kCIInputImageKey

      A key for the CIImage object to use as an input image. For filters that also use a background image, this key refers to the foreground image.

      Available in OS X v10.5 and later. Available in iOS 5.0 and later.

    • kCIInputTimeKey

      kCIInputTimeKey

      A key for z scalar value (NSNumber) that specifies a time.

      Available in OS X v10.5 and later. Not available in iOS.

    • kCIInputTransformKey

      kCIInputTransformKey

      A key for an NSAffineTransform object that specifies a transformation to apply.

      Available in OS X v10.5 and later. Not available in iOS.

    • kCIInputScaleKey

      kCIInputScaleKey

      A key for a scalar value (NSNumber) that specifies the amount of the effect.

      Available in OS X v10.5 and later. Not available in iOS.

    • kCIInputAspectRatioKey

      kCIInputAspectRatioKey

      A key for a scalar value (NSNumber) that specifies a ratio.

      Available in OS X v10.5 and later. Not available in iOS.

    • kCIInputCenterKey

      kCIInputCenterKey

      A key for a CIVector object that specifies the center of the area, as x and y- coordinates, to be filtered.

      Available in OS X v10.5 and later. Not available in iOS.

    • kCIInputRadiusKey

      kCIInputRadiusKey

      A key for a scalar value (NSNumber) that specifies that specifies the distance from the center of an effect.

      Available in OS X v10.5 and later. Not available in iOS.

    • kCIInputAngleKey

      kCIInputAngleKey

      A key for a scalar value (NSNumber) that specifies an angle.

      Available in OS X v10.5 and later. Not available in iOS.

    • kCIInputRefractionKey

      kCIInputRefractionKey

      A key for a scalar value (NSNumber) that specifies the index of refraction of the material (such as glass) used in the effect.

      Available in OS X v10.5 and later. Not available in iOS.

    • kCIInputWidthKey

      kCIInputWidthKey

      A key for a scalar value (NSNumber) that specifies the width of the effect.

      Available in OS X v10.5 and later. Not available in iOS.

    • kCIInputSharpnessKey

      kCIInputSharpnessKey

      A key for a scalar value (NSNumber) that specifies the amount of sharpening to apply.

      Available in OS X v10.5 and later. Not available in iOS.

    • kCIInputIntensityKey

      kCIInputIntensityKey

      A key for a scalar value (NSNumber) that specifies an intensity value.

      Available in OS X v10.5 and later. Not available in iOS.

    • kCIInputEVKey

      kCIInputEVKey

      A key for a scalar value (NSNumber) that specifies how many F-stops brighter or darker the image should be.

      Available in OS X v10.5 and later. Not available in iOS.

    • kCIInputSaturationKey

      kCIInputSaturationKey

      A key for a scalar value (NSNumber) that specifies the amount to adjust the saturation.

      Available in OS X v10.5 and later. Not available in iOS.

    • kCIInputColorKey

      kCIInputColorKey

      A key for a CIColor object that specifies a color value.

      Available in OS X v10.5 and later. Not available in iOS.

    • kCIInputBrightnessKey

      kCIInputBrightnessKey

      A key for a scalar value (NSNumber) that specifies a brightness level.

      Available in OS X v10.5 and later. Not available in iOS.

    • kCIInputContrastKey

      kCIInputContrastKey

      A key for a scalar value (NSNumber) that specifies a contrast level.

      Available in OS X v10.5 and later. Not available in iOS.

    • kCIInputGradientImageKey

      kCIInputGradientImageKey

      A key for a CIImage object that specifies an environment map with alpha. Typically, this image contains highlight and shadow.

      Available in OS X v10.5 and later. Not available in iOS.

    • kCIInputMaskImageKey

      kCIInputMaskImageKey

      A key for a CIImage object to use as a mask.

      Available in OS X v10.5 and later. Not available in iOS.

    • kCIInputShadingImageKey

      kCIInputShadingImageKey

      A key for a CIImage object that specifies an environment map with alpha values. Typically this image contains highlight and shadow.

      Available in OS X v10.5 and later. Not available in iOS.

    • kCIInputTargetImageKey

      kCIInputTargetImageKey

      A key for a CIImage object that is the target image for a transition.

      Available in OS X v10.5 and later. Not available in iOS.

    • kCIInputExtentKey

      kCIInputExtentKey

      A key for a CIVector object that specifies a rectangle that defines the extent of the effect.

      Available in OS X v10.5 and later. Not available in iOS.

    • kCIInputVersionKey

      kCIInputVersionKey

      A key for an NSNumber object that specifies a version number.

      Not available in OS X. Available in iOS 6.0 and later.

    Discussion

    These keys represent some of the most commonly used input parameters. A filter can use other kinds of input parameters.

  • Options for creating a CIFilter object from RAW image data.

    Declaration

    Swift

    let kCIInputBiasKey: String

    Objective-C

    NSString * const kCIInputNeutralLocation; NSString * const kCIInputBiasKey;

    Constants

    • kCIInputBiasKey

      kCIInputBiasKey

      A key for the simple bias value to use along with the exposure adjustment (kCIInputEVKey). The associated value must be an NSNumber object that specifies floating-point value. The value has no effect if the image used for initialization is not RAW.

      Available in iOS 9.0 and later.

    Discussion

    You can also use the key kCIInputEVKey for RAW images.