Class

CIFilter

An image processor that produces an image by manipulating one or more input images or by generating new image data.

Declaration

@interface CIFilter : NSObject

Overview

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 mutable, and thus cannot be shared safely among threads. Each thread must create its own CIFilter objects, but you can pass a filter’s immutable input and output CIImage objects between threads.

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

  • By using an image-processing kernel that you write

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 set the values of all input parameters to nil.

Topics

Creating a Filter

+ filterWithName:

Creates a CIFilter object for a specific kind of filter.

+ filterWithName:withInputParameters:

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

+ filterWithName:keysAndValues:

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

Creating a Filter from a RAW Image

+ filterWithImageData:options:

A filter which allows the processing of RAW images

+ filterWithImageURL:options:

A filter which allows the processing of RAW images

+ filterWithCVPixelBuffer:properties:options:

Creates a filter from a Core Video pixel buffer.

Accessing Registered Filters

+ filterNamesInCategories:

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

+ filterNamesInCategory:

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

Registering a Filter

+ registerFilterName:constructor:classAttributes:

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

Getting Filter Parameters and Attributes

- setName:

A name associated with a filter.

enabled

A Boolean value that determines whether the filter is enabled. Animatable.

attributes

A dictionary of key-value pairs that describe the filter.

inputKeys

The names of all input parameters to the filter.

outputKeys

The names of all output parameters from the filter.

outputImage

Returns a CIImage object that encapsulates the operations configured in the filter.

Setting Default Values

- setDefaults

Sets all input values for a filter to default values.

Applying a Filter

- apply:arguments:options:

Produces a CIImage object by applying arguments to a kernel function and using options to control how the kernel function is evaluated.

- apply:

Produces a CIImage object by applying a kernel function.

Getting Localized Information for Registered Filters

+ localizedNameForFilterName:

Returns the localized name for the specified filter name.

+ localizedNameForCategory:

Returns the localized name for the specified filter category.

+ localizedDescriptionForFilterName:

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

+ localizedReferenceDocumentationForFilterName:

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

Creating a Configuration View for a Filter

- viewForUIConfiguration:excludedKeys:

Returns a filter view for the filter.

Serializing and Deserializing Filters

+ serializedXMPFromFilters:inputImageExtent:

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

+ filterArrayFromSerializedXMP:inputImageExtent:error:

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

Constants

Filter Attribute Keys

Attributes for a filter and its parameters.

Options for Applying a Filter

Options that control the application of a custom Core Image filter.

User Interface Control Options

Sets of controls for various user scenarios.

User Interface Options

Keys or values for the size of the input parameter controls for a filter view.

Filter Parameter Keys

Keys for input parameters to filters.

RAW Image Options

Options for creating a CIFilter object from RAW image data.

Type Methods

+ accordionFoldTransitionFilter

Returns an accordion fold transition filter.

+ additionCompositingFilter

Returns an addition compositing filter.

+ affineClampFilter

Returns an affine clamp filter.

+ affineTileFilter

Returns a affine tile filter.

+ attributedTextImageGeneratorFilter

Returns an attributed-text image generator filter.

+ aztecCodeGeneratorFilter

Returns a Aztec code generator filter.

+ barcodeGeneratorFilter

Returns a barcode generator filter.

+ barsSwipeTransitionFilter

Returns a bars swipe transition filter.

+ bicubicScaleTransformFilter

Returns a bicubic scale transform filter.

+ blendWithAlphaMaskFilter

Returns a blend with alpha mask filter.

+ blendWithBlueMaskFilter

Returns a blend with blue mask filter.

+ blendWithMaskFilter

Returns a blend with mask filter.

+ blendWithRedMaskFilter

Returns a blend with red mask filter.

+ bloomFilter

Returns a bloom filter.

+ bokehBlurFilter

Returns a bokeh blur filter.

+ boxBlurFilter

Returns a box blur filter.

+ checkerboardGeneratorFilter

Returns a checkerboard generator filter.

+ circularScreenFilter

Returns a circular screen filter.

+ CMYKHalftone

Returns a CMYK halftone filter.

+ code128BarcodeGeneratorFilter

Returns a Code 128 barcode generator filter.

+ colorBlendModeFilter

Returns a color blend mode filter.

+ colorBurnBlendModeFilter

Returns a color-burn blend mode filter.

+ colorClampFilter

Returns a color clamp filter.

+ colorControlsFilter

Returns a color controls filter.

+ colorCrossPolynomialFilter

Returns a color cross-polynomial filter.

+ colorCubeFilter

Returns a color cube filter.

+ colorCubeWithColorSpaceFilter

Returns a color cube with color space filter.

+ colorCubesMixedWithMaskFilter

Returns a color cube mixed with mask filter.

+ colorCurvesFilter

Returns a color curves filter.

+ colorDodgeBlendModeFilter

Returns a color-dodge blend mode filter.

+ colorInvertFilter

Returns a color invert filter.

+ colorMapFilter

Returns a color map filter.

+ colorMatrixFilter

Returns a color matrix filter.

+ colorMonochromeFilter

Returns a color monochrome filter.

+ colorPolynomialFilter

Returns a color polynomial filter.

+ colorPosterizeFilter

Returns a color posterize filter.

+ comicEffectFilter

Returns a comic effect filter.

+ convolution3X3Filter

Returns a convolution 3 x 3 filter.

+ convolution5X5Filter

Returns a convolution 5 x 5 filter.

+ convolution7X7Filter

Returns a convolution 7 x 7 filter.

+ convolution9HorizontalFilter

Returns a convolution 9 horizontal filter.

+ convolution9VerticalFilter

Returns a convolution 9 vertical filter.

+ copyMachineTransitionFilter

Returns a copy machine transition filter.

+ coreMLModelFilter

Returns a Core ML model filter.

+ crystallizeFilter

Returns a crystalize filter.

+ darkenBlendModeFilter

Returns a darken blend mode filter.

+ depthOfFieldFilter

Returns a depth-of-field filter.

+ depthToDisparityFilter

Returns a depth-to-disparity filter.

+ differenceBlendModeFilter

Returns a difference blend mode filter.

+ discBlurFilter

Returns a disc blur filter.

+ disintegrateWithMaskTransitionFilter

Returns a disintegrate-with-mask transition filter.

+ disparityToDepthFilter

Returns a disparity-to-depth filter.

+ dissolveTransitionFilter

Returns a dissolve transition filter.

+ ditherFilter

Returns a dither filter.

+ divideBlendModeFilter

Returns a divide blend mode filter.

+ documentEnhancerFilter

Returns a document enhancer filter.

+ dotScreenFilter

Returns a dot screen filter.

+ edgePreserveUpsampleFilter

Returns an edge preserve upsample filter.

+ edgeWorkFilter

Returns an edge-work filter.

+ edgesFilter

Returns an edges filter.

+ eightfoldReflectedTileFilter

Returns an eightfold reflected tile filter.

+ exclusionBlendModeFilter

Returns an exclusion blend mode filter.

+ exposureAdjustFilter

Returns an exposure adjust filter.

+ falseColorFilter

Returns a false color filter.

+ flashTransitionFilter

Returns a flash transition filter.

+ fourfoldReflectedTileFilter

Returns a fourfold reflected tile filter.

+ fourfoldRotatedTileFilter

Returns a fourfold rotated tile filter.

+ fourfoldTranslatedTileFilter

Returns a fourfold translated tile filter.

+ gaborGradientsFilter

Returns a Gabor gradients filter.

+ gammaAdjustFilter

Returns a gamma adjust filter.

+ gaussianBlurFilter

Returns a Gaussian blur filter.

+ gaussianGradientFilter

Returns a Gaussian gradient filter.

+ glideReflectedTileFilter

Returns a glide reflected tile filter.

+ gloomFilter

Returns a gloom filter.

+ hardLightBlendModeFilter

Returns a hard-light blend mode filter.

+ hatchedScreenFilter

Returns a hatched screen filter.

+ heightFieldFromMaskFilter

Returns a height-field-from-mask filter.

+ hexagonalPixellateFilter

Returns a hexagonal pixellate filter.

+ highlightShadowAdjustFilter

Returns a highlight-shadow adjust filter.

+ hueAdjustFilter

Returns a hue adjust filter.

+ hueBlendModeFilter

Returns a hue blend mode filter.

+ hueSaturationValueGradientFilter

Returns a hue-saturation-value gradient filter.

+ kaleidoscopeFilter

Returns a kaleidoscope filter.

+ keystoneCorrectionCombinedFilter

Returns a keystone correction combined filter.

+ keystoneCorrectionHorizontalFilter

Returns a keystone correction horizontal filter.

+ keystoneCorrectionVerticalFilter

Returns a keystone correction vertical filter.

+ LabDeltaE

Returns a Lab Delta E filter.

+ lanczosScaleTransformFilter

Returns a Lanczos scale transform filter.

+ lenticularHaloGeneratorFilter

Returns a lenticular halo generator filter.

+ lightenBlendModeFilter

Returns a lighten blend mode filter.

+ lineOverlayFilter

Returns a line overlay filter.

+ lineScreenFilter

Returns a line screen filter.

+ linearBurnBlendModeFilter

Returns a linear-burn blend mode filter.

+ linearDodgeBlendModeFilter

Returns a linear-dodge blend mode filter.

+ linearGradientFilter

Returns a linear gradient filter.

+ linearToSRGBToneCurveFilter

Returns a linear-to-sRGB filter.

+ luminosityBlendModeFilter

Returns a luminosity blend mode filter.

+ maskToAlphaFilter

Returns a mask-to-alpha filter.

+ maskedVariableBlurFilter

Returns a masked variable blur filter.

+ maximumComponentFilter

Returns a maximum component filter.

+ maximumCompositingFilter

Returns a maximum compositing filter.

+ medianFilter

Returns a median filter.

+ meshGeneratorFilter

Returns a mesh generator filter.

+ minimumComponentFilter

Returns a minimum component filter.

+ minimumCompositingFilter

Returns a minimum compositing filter.

+ mixFilter

Returns a mix filter.

+ modTransitionFilter

Returns a mod transition filter.

+ morphologyGradientFilter

Returns a morphology gradient filter.

+ morphologyMaximumFilter

Returns a morphology maximum filter.

+ morphologyMinimumFilter

Returns a morphology minimum filter.

+ morphologyRectangleMaximumFilter

Returns a morphology rectangle maximum filter.

+ morphologyRectangleMinimumFilter

Returns a morphology rectangle minimum filter.

+ motionBlurFilter

Returns a morphology motion blur filter.

+ multiplyBlendModeFilter

Returns a multiply blend mode filter.

+ multiplyCompositingFilter

Returns a multiply compositing filter.

+ noiseReductionFilter

Returns a morphology noise reduction filter.

+ opTileFilter

Returns an optical tile filter.

+ overlayBlendModeFilter

Returns an overlay blend mode filter.

+ pageCurlTransitionFilter

Returns a page curl transition filter.

+ pageCurlWithShadowTransitionFilter

Returns a page-curl-with-shadow transition filter.

+ paletteCentroidFilter

Returns a palette centroid filter.

+ palettizeFilter

Returns a palettize filter.

+ parallelogramTileFilter

Returns a parallelogram tile filter.

+ PDF417BarcodeGenerator

Returns a PDF417 barcode generator filter.

+ perspectiveCorrectionFilter

Returns a perspective correction filter.

+ perspectiveRotateFilter

Returns a perspective rotate filter.

+ perspectiveTileFilter

Returns a perspective tile filter.

+ perspectiveTransformFilter

Returns a perspective transform filter.

+ perspectiveTransformWithExtentFilter

Returns a perspective transform with extent filter.

+ photoEffectChromeFilter

Returns a photo-effect chrome filter.

+ photoEffectFadeFilter

Returns a photo-effect fade filter.

+ photoEffectInstantFilter

Returns a photo-effect instant filter.

+ photoEffectMonoFilter

Returns a photo-effect mono filter.

+ photoEffectNoirFilter

Returns a photo-effect noir filter.

+ photoEffectProcessFilter

Returns a photo-effect process filter.

+ photoEffectTonalFilter

Returns a photo-effect tonal filter.

+ photoEffectTransferFilter

Returns a photo-effect transfer filter.

+ pinLightBlendModeFilter

Returns a pin-light blend mode filter.

+ pixellateFilter

Returns a pixellate filter.

+ pointillizeFilter

Returns a pointillize filter.

+ QRCodeGenerator

Returns a QR code generator filter.

+ radialGradientFilter

Returns a radial gradient filter.

+ randomGeneratorFilter

Returns a random generator filter.

+ rippleTransitionFilter

Returns a ripple transition filter.

+ roundedRectangleGeneratorFilter

Returns a rounded rectangle generator filter.

+ sRGBToneCurveToLinearFilter

Returns an sRGB-to-linear filter.

+ saliencyMapFilter

Returns a saliency map filter.

+ saturationBlendModeFilter

Returns a saturation blend mode filter.

+ screenBlendModeFilter

Returns a screen blend mode filter.

+ sepiaToneFilter

Returns a sepia-tone filter.

+ shadedMaterialFilter

Returns a shaded material filter.

+ sharpenLuminanceFilter

Returns a sharpen luminance filter.

+ sixfoldReflectedTileFilter

Returns a sixfold reflected tile filter.

+ sixfoldRotatedTileFilter

Returns a sixfold rotated tile filter.

+ smoothLinearGradientFilter

Returns a smooth linear gradient filter.

+ softLightBlendModeFilter

Returns a soft-light blend mode filter.

+ sourceAtopCompositingFilter

Returns a source-atop compositing filter.

+ sourceInCompositingFilter

Returns a source-in compositing filter.

+ sourceOutCompositingFilter

Returns a source-out compositing filter.

+ sourceOverCompositingFilter

Returns a source-over compositing filter.

+ spotColorFilter

Returns a spot color filter.

+ spotLightFilter

Returns a spotlight filter.

+ starShineGeneratorFilter

Returns a star-shine generator filter.

+ straightenFilter

Returns a straighten filter.

+ stripesGeneratorFilter

Returns a stripes generator filter.

+ subtractBlendModeFilter

Returns a subtract blend mode filter.

+ sunbeamsGeneratorFilter

Returns a sunbeams generator filter.

+ swipeTransitionFilter

Returns a swipe transition filter.

+ temperatureAndTintFilter

Returns a temperature and tint filter.

+ textImageGeneratorFilter

Returns a text image generator filter.

+ thermalFilter

Returns a thermal filter.

+ toneCurveFilter

Returns a tone curve filter.

+ triangleKaleidoscopeFilter

Returns a triangle kaleidoscope filter.

+ triangleTileFilter

Returns a triangle tile filter.

+ twelvefoldReflectedTileFilter

Returns a twelvefold reflected tile filter.

+ unsharpMaskFilter

Returns an unsharp mask filter.

+ vibranceFilter

Returns a vibrance filter.

+ vignetteFilter

Returns a vignette filter.

+ vignetteEffectFilter

Returns a vignette-effect filter.

+ whitePointAdjustFilter

Returns a white-point adjust filter.

+ xRayFilter

Returns an X-ray filter.

+ zoomBlurFilter

Returns a zoom blur filter.

Relationships

Inherits From

See Also

First Steps

Processing an Image Using Built-in Filters

Apply effects such as sepia tint, highlight strengthening, and scaling to images.

CIImage

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

CIContext

An evaluation context for rendering image processing results and performing image analysis.

Basic Data Types

Colors, vectors, and other types used in applying or creating image filters.