iOS Guides | Samples

MonoTouch.CoreImage Namespace

The CoreImage namespace provides hardware-accelerated image processing.


CoreImage provides a framework for processing still images and applying a set of operations on them to either produce new images or perform image analysis (like performing face detection and photography auto-enhance). The operations are hardware accelerated and provide better performance than most hand written implementations.

CoreImage can apply either one filter to an image or you can use the built-in chaining support to apply a series of filters at once to an image. For example, you could apply a Sepia Filter, followed by a Hue adjustment filter, followed by a contrast filter. The idea behind the chaining support is to avoid intermediate copies and intermediate buffers during image processing. Additionally, some of these filtering operations can be performed entirely on the GPU in a single pass, without having to copy data back and forth from the GPU to the main memory.

The CoreImage runtime sits below the MonoTouch.CoreGraphics, MonoTouch.CoreVideo and MonoTouch.ImageIO stacks and provides services to all of them. Depending on the filter operations and the hardware platform, CoreImage will execute the filters in the CPU or the GPU.

To use CoreImage on iOS, you follow these steps:

  • Create a CIImage object. You can create these from multiple sources: CoreGraphics images, bitmap data, images on disk or CoreVideo image buffers. CIImage objects are immutable and represent recipes, that is, they will be computed on demand.
  • Create and configure a CIFilters object. This object combines image inputs or numeric input parameters to configure the effects of the filter. The configuration is done by setting various properties using the object indexer to any of the values documented in the
  • Create a CIContext object to track the processing pipeline. This is the object trough which CoreImage draws and it can be CPU or GPU bound.
  • Render the filter output into a target image using one of the CIContext methods.

C# Example

	// This sample turns the image into a sepia image

	// Load the image using UIImage, it is convenient
	var uiimage = UIImage.FromFile ("sample.jpg");

	// Create the CIImage, using the UIImage's CGImage as a reference
	var image = new CIImage (uiimage.CGImage);

	// Create the filter
	var sepia = new CISepiaTone () {
		Image = image,
		Intensity = .8f

	// Generate the recipe.   It is important to note that at this point
	// the resulting CIImage merely contains the recipe on how to create
	// the image, this is important, because you can use this result as
	// the input to another filter to chain filters together and only 
	// at the last minute, when the CIContext rendering APIs are used,
	// does the actual pipeline execute.   This allows for a series of
	// operations to all be performed in one step without intermediate
	// buffer copies.
	CIImage output = sepia.OutputImage;

	// To render the results, we need to create a context, and then
	// use one of the context rendering APIs, in this case, we render the
	// result into a CoreGraphics image, which is merely a useful representation
	var context = CIContext.FromOptions (null);
	var cgimage = context.CreateCGImage (output, output.Extent);

	// The above cgimage can be added to a screen view, for example, this
	// would add it to a UIImageView on the screen:
	myImageView.Image = UIImage.FromImage (cgimage);

Face detection is done with the CIDetector class by calling the CIDetector.CreateFaceDetector(CIContext,bool) method which returns an array of CIFeature objects with any detected face features found.

Auto-adjustments are implemented by calling the CoreImage.GetAutoAdjustmentFilters method. This method returns a list of suggested CIFilter which you in turn would apply to your image and render to a context.

To chain filters, all you have to do is connect the OutputImage property from a filter to the Image property of another filter. This is a modified version of the previous example showing how to chain two filters together:

C# Example

	var uiimage = UIImage.FromFile ("sample.jpg");
	var image = new CIImage (uiimage.CGImage);

	var sepia = new CISepiaTone () {
		Image = image,
		Intensity = .8f
	// Chain the Sepia filter to a Color inversion filter, this is done
	// by assigning the CIColorInvert.Input to the sepia.OutputImage
	var invert = new CIColorInvert () {
		Image = sepia.OutputImage;

	CIImage output = invert.OutputImage;
	var context = CIContext.FromOptions (null);
	var cgimage = context.CreateCGImage (output, output.Extent);

	myImageView.Image = UIImage.FromImage (cgimage);


CIAccordionFoldTransitionAnimates a transition by creating an accordion-fold effect on the source image.
CIAdditionCompositingThe CIAdditionCompositing CoreImage filter.
CIAffineClampA CIAffineFilter that extends the border pixels to the post-transform boundaries.
CIAffineFilterAn abstract class that defines a CIFilter that performs an affine transform on an image and then performs a filtering operation on the transformed image.
CIAffineTileA CIAffineFilter that tiles the transformed image.
CIAffineTransformPerforms an affine transform on an image.
CIAreaAverageProduces a single-pixel image. The pixel is the average color of the input extent.
CIAreaHistogramCreates histogram data for a given image and rectangle of interest.
CIAreaMaximumProduces a single-pixel image. The pixel's components are set to the maximum of that component within the input extent.
CIAreaMaximumAlphaReturns a single-pixel image. The color is that of the pixel in the input extent with the greatest alpha value.
CIAreaMinimumReturns a single-pixel image. The pixel's components are set to the minimum of that component within the input extent.
CIAreaMinimumAlphaReturns a single-pixel image. The color is that of the pixel in the input extent with the lowest alpha value.
CIAutoAdjustmentFilterOptionsWhen passed to CIImage.GetAutoAdjustmentFilters, limits the results.
CIAztecCodeGeneratorGenerates an Aztec code for the specified CIAztecCodeGenerator.Message.
CIBarsSwipeTransitionA CITransitionFilter that animates a transition by moving a bar over the source image.
CIBlendFilterAn abstract CIFilter that combines a background and foreground image.
CIBlendWithAlphaMaskA CIBlendWithMask that uses a mask image to blend foreground and background images.
CIBlendWithMaskA CIBlendFilter that uses a grayscale mask to blends its foreground and background images.
CIBloomA CIFilter that creates an edge-flow effect.
CIBoxBlurApplies a blur created with a box-shaped convolution kernel.
CIBumpDistortionA CIDistortionFilter that creates a bump at the specified center point.
CIBumpDistortionLinearA filter that distorts the image around a convex or concave line.
CICheckerboardGeneratorThe CICheckerboardGenerator CoreImage filter
CICircleSplashDistortionMakes the pixels at the circumference of a circle spread out to the boundaries of the image.
CICircularScreenA CIScreenFilter that creates a circular bulls-eye-style halftone screen.
CICircularWrapDistorts the input image so that it appears as if wrapped around a transparent circle.
CICmykHalftoneProduce a color half-tone image built from cyan, magenta, yellow, and black 'inks'.
CICode128BarcodeGeneratorGenerates a Code 128 barcode.
CICodeGeneratorBase class for code generators.
CIColorA Core Image color, including both color values and a reference to a color space.
CIColorBlendModeThe CIColorBlendMode CoreImage filter
CIColorBurnBlendModeThe CIColorBurnBlendMode CoreImage filter
CIColorClampA filter that constrains the color values between the range specified.
CIColorControlsThe CIColorControls CoreImage filter
CIColorCrossPolynomialA filter that modifies the source pixels by applying a set of polynomial cross-products.
CIColorCubeThe CIColorCube CoreImage filter
CIColorCubeWithColorSpaceA filter that modifies the source pixels using a 3D color-table and then maps the result to a color space.
CIColorDodgeBlendModeThe CIColorDodgeBlendMode CoreImage filter
CIColorInvertThe CIColorInvert CoreImage filter
CIColorKernelKernel for a GPU process that only operates on color data.
CIColorMapChanges colors based on an input gradient image's mapping.
CIColorMatrixThe CIColorMatrix CoreImage filter.
CIColorMonochromeThe CIColorMonochrome CoreImage filter
CIColorPolynomialA filter that modifies the source pixels by applying a set of cubic polynomials.
CIColorPosterizeReduces the number of levels for each color component.
CIColumnAverageReturns a 1-pixel high image with the same width as the input image. Every pixel is the average color of the corresponding column in the input image.
CIComicEffectProduces an image with outlined edges and a color halftone effect.
CICompositingFilterAn abstract CIFilter that composites two images.
CIConstantColorGeneratorThe CIConstantColorGenerator CoreImage filter
CIContextOrchestrates the rendering of a CIFilter pipeline.
CIContextOptionsUse to configure the CIContext rendering pipeline.
CIConvolution3X3A filter that performs a custom 3x3 matrix convolution.
CIConvolution5X5A filter that performs a custom 5x5 matrix convolution.
CIConvolution7X7A filter that performs a custom 7x7 matrix convolution.
CIConvolution9HorizontalA filter that performs a horizontal convolution of 9 elements.
CIConvolution9VerticalA filter that performs a vertical convolution of 9 elements.
CIConvolutionCoreAn abstract class that is the base for convolution filters.
CICopyMachineTransitionA CITransitionFilter that mimics the effect of a photocopier.
CICropThe CICrop CoreImage filter
CICrystallizeCreates irregular blocks of average color from the source image.
CIDarkenBlendModeThe CIDarkenBlendMode CoreImage filter
CIDepthOfFieldSimulates a blurred depth of field and applies a saturation effect to the 'in-focus' region.
CIDetectorImage analysis class for face detection.
CIDetectorOptionsOptions for use with face detection. Used with CIDetector.CreateFaceDetector.
CIDifferenceBlendModeThe CIDifferenceBlendMode CoreImage filter
CIDiscBlurApplies a blur created with a disc-shaped convolution kernel.
CIDisintegrateWithMaskTransitionA CITransitionFilter that uses a mask to define the transition.
CIDisplacementDistortionTextures the input image by the grayscale value of the corresponding pixels in the displacement image.
CIDissolveTransitionA CITransitionFilter that performs a cross-dissolve.
CIDistortionFilterAn abstract CIFilter for distortions.
CIDivideBlendModeA CIBlendFilter that divides the color values of its CIBlendFilter.Image and CIBlendFilter.BackgroundImage.
CIDotScreenA CIScreenFilter that screens with a halftone dot pattern.
CIDrosteCreates a series of increasingly smaller boxes repeating a portion of the image.
CIEdgesCreates a colorized edge-detection effect.
CIEdgeWorkCreates a black and white woodblock effect.
CIEightfoldReflectedTileA CITileFilter that applies 8-way reflected symmetry.
CIExclusionBlendModeThe CIExclusionBlendMode CoreImage filter
CIExposureAdjustThe CIExposureAdjust CoreImage filter
CIFaceBalanceThe CIFaceBalance CoreImage filter
CIFaceFeatureLocations of the eyes and mouths in a detected face. In video sequences, attempts to maintain a consistent CIFaceFeature.TrackingID.
CIFalseColorThe CIFalseColor CoreImage filter
CIFeatureAn area of an image in which a CIDetector has detected a match.
CIFilterCoreImage image filter.
CIFilterAttributesConstants used for CIFilter's attributes
CIFilterCategoryConstants used for CIFilter filtering facilities to find filters by category.
CIFilterInputKeyKeys that can be used to configure the CIFilter input values.
CIFilterOutputKeyKeys that can be used to get output results out of a CIFilter.
CIFilterShapeMasks filter operations to areas composed of the intersections, unions, and affine transformations of rectangles and other similarly constructed filter shapes.
CIFlashTransitionA CITransitionFilter that presents a starburst-like flash.
CIFormatAn enumeration whose values specify color spaces.
CIFourfoldReflectedTileA CITileFilter that applies 4-way reflected symmetry.
CIFourfoldRotatedTileA CITileFilter that rotates the source image in 90-degree increments.
CIFourfoldTranslatedTileA CITileFilter that applies four translations to the source image.
CIGammaAdjustThe CIGammaAdjust CoreImage filter
CIGaussianBlurApplies a Gaussian blur.
CIGaussianGradientThe CIGaussianGradient CoreImage filter
CIGlassDistortionDistorts the input image so that it appears viewed through glass blocks whose geometry corresponds to the CIGlassDistortion.Texture image.
CIGlassLozengeCreates an effect as if a lozenge-shaped lens were placed on the input image.
CIGlideReflectedTileA CITileFilter that translates and smears the source image.
CIGloomA CIFilter that dulls the highlights of the source image.
CIHardLightBlendModeThe CIHardLightBlendMode CoreImage filter
CIHatchedScreenA CIScreenFilter that filters via a hatched halftone pattern.
CIHeightFieldFromMaskCreates a continuous height field from a grayscale mask. Use with CIShadedMaterial to create realistic dropshadows.
CIHexagonalPixellatePixellates the image with hexagonals based on the average color of pixels within the hexagon.
CIHighlightShadowAdjustThe CIHighlightShadowAdjust CoreImage filter
CIHistogramDisplayFilterRenders a one-dimensional CIFilter.Image histogram as a typical two-dimensional histogram.
CIHoleDistortionA CIDistortionFilter that distorts pixels around a circular area.
CIHueAdjustThe CIHueAdjust CoreImage filter
CIHueBlendModeThe CIHueBlendMode CoreImage filter
CIImageRepresents a set of instructions to create an image for use by CoreImage.
CIImageAccumulatorA feedback image processor.
CIImageInitializationOptionsOptions that can be used when initializing a new CIImage.
CIImageInitializationOptionsWithMetadataA type of CIImageInitializationOptions that has additional metadata properties.
CIImageOrientationAn enumeration whose values specify the origin of the CIImage.
CIKaleidoscopeProduces a kaleidoscopic, 12-way-symmetrical, image.
CIKernelA kernel for filters that use custom GPU steps.
CIKernelRoiCallbackCompletion handler for deterimining a region of interest in the source image.
CILanczosScaleTransformA scaling transform that uses Lanczos resampling.
CILenticularHaloGeneratorCreates an artificial lens-flare.
CILightenBlendModeThe CILightenBlendMode CoreImage filter
CILightTunnelA CIFilter that creates a spiraling effect.
CILinearBurnBlendModeDarkens the image based on the colors of the background image.
CILinearDodgeBlendModeDarkens the image based on the colors of the background image.
CILinearGradientThe CILinearGradient CoreImage filter
CILinearToSRGBToneCurveA filter that maps color intensity from a linear gamma curve to the sRGB color space.
CILineOverlayProduces a black-and-white sketch-like image via edge detection.
CILineScreenA CIScreenFilter that simulates a halftone made of lines.
CILuminosityBlendModeThe CILuminosityBlendMode CoreImage filter
CIMaskToAlphaA CIFilter that converts a grayscale image to an alpha mask.
CIMaximumComponentA CIFilter that creates a grayscale image from the maximum value of the RGB color values.
CIMaximumCompositingThe CIMaximumCompositing CoreImage filter
CIMedianFilterReplaces pixel values with the median of neighboring pixel values, thus reducing noise in the input image.
CIMinimumComponentA CIFilter that creates a grayscale image from the minimum component of the RGB values.
CIMinimumCompositingThe CIMinimumCompositing CoreImage filter
CIModTransitionA CITransitionFilter that reveals the background image via a series of irregularly shaped holes.
CIMotionBlurApplies a blur that simulates the motion of a camera during capture.
CIMultiplyBlendModeThe CIMultiplyBlendMode CoreImage filter
CIMultiplyCompositingThe CIMultiplyCompositing CoreImage filter
CINoiseReductionReduces noise by detecting luminance variations. Small luminance variations are locally blurred, large variations are locally sharpened.
CIOpTileCreates an 'op art' effect by tiling, scaling, and rotating regions of the image.
CIOverlayBlendModeThe CIOverlayBlendMode CoreImage filter
CIPageCurlTransitionAnimates a page curl transition between images.
CIPageCurlWithShadowTransitionAnimates a page curl transition, with a shadow, between images.
CIParallelogramTileWarps an image into a parallelogram and then tiles the result.
CIPdf417BarcodeGeneratorGenerator for 2-dimensional PDF417 bar codes.
CIPerspectiveCorrectionA CIPerspectiveTransform that is cropped according to the perspective control points, but whose pixels are not transformed.
CIPerspectiveTileA CIFilter that applies a perspective transform and then tiles the result.
CIPerspectiveTransformA CIFilter that applies a transform the simulates perspective.
CIPerspectiveTransformWithExtentA filter that alters a portion of the total image based on a perspective transform.
CIPhotoEffectThe base class for photo effect filters.
CIPhotoEffectChromeA filter that exaggerates color of the image producing a vintage look.
CIPhotoEffectFadeA filter that reduces color of the image producing a vintage look.
CIPhotoEffectInstantA filter that that distorts colors in a style reminiscent of instant film.
CIPhotoEffectMonoA filter that produces a low-contrast black-and-white image.
CIPhotoEffectNoirA filter that produces a high-contrast black-and-white image.
CIPhotoEffectProcessA filter that produces a vintage look with exagerrated cool colors.
CIPhotoEffectTonalA filter that produces a black-and-white image with minimal contrast changes.
CIPhotoEffectTransferA filter that produces a vintage look with exagerrated warm colors.
CIPinchDistortionA CIDistortionFilter that pinches pixels towards a rectangular area.
CIPinLightBlendModeReplaces image colors with the bright colors from the background image.
CIPixellateA CIFilter that pixelates the original image.
CIPointillizeCreates an effect mimicking artistic pointillization.
CIQRCodeFeatureA detected QR code.
CIQRCodeGeneratorGenerates a QR code.
CIRadialGradientThe CIRadialGradient CoreImage filter
CIRandomGeneratorA CIFilter whose pixels are randomly colored.
CIRectangleFeatureA CIFeature an image space rectange that contains a detected physical rectangle.
CIRippleTransitionAnimates a ripple transition between images.
CIRowAverageReturns a 1-pixel-high image, the pixels of which are the average color for the corresponding row in the input image.
CISaturationBlendModeThe CISaturationBlendMode CoreImage filter
CIScreenBlendModeThe CIScreenBlendMode CoreImage filter
CIScreenFilterA CIFilter that mimics halftone screens.
CISepiaToneThe CISepiaTone CoreImage filter
CIShadedMaterialProduces a shaded image from a height field, such as that produced by CIHeightFieldFromMask.
CISharpenLuminanceA CIFilter that sharpens the image.
CISixfoldReflectedTileA CITileFilter that applies 6-way reflected symmetry.
CISixfoldRotatedTileA CITileFilter that rotates the image in 60-degree increments.
CISmoothLinearGradientA filter that produces a gradient along a linear axis between two endpoints.
CISoftLightBlendModeThe CISoftLightBlendMode CoreImage filter
CISourceAtopCompositingThe CISourceAtopCompositing CoreImage filter
CISourceInCompositingThe CISourceInCompositing CoreImage filter
CISourceOutCompositingThe CISourceOutCompositing CoreImage filter
CISourceOverCompositingThe CISourceOverCompositing CoreImage filter
CISpotColorReplaces color ranges with specified replacement colors.
CISpotLightProduces an effect mimicking that of a directional spotlight.
CISRGBToneCurveToLinearA filter that adjusts tone response in sRGB color space and then maps it to a linear gamma curve.
CIStarShineGeneratorA CIFilter that simulates lens flare.
CIStraightenFilterThe CIStraightenFilter CoreImage filter
CIStretchCropStretches and crops an image.
CIStripesGeneratorThe CIStripesGenerator CoreImage filter
CISubtractBlendModeSubtracts the background image pixels from those in the CIFilter.Image.
CISunbeamsGeneratorCreates an artificial sun and light-ray effect.
CISwipeTransitionA CITransitionFilter that swipes from one image to the other.
CITemperatureAndTintThe CITemperatureAndTint CoreImage filter
CITextFeatureA detected text feature.
CITileFilterA CIFilter that applies a filter and then tiles the results.
CIToneCurveThe CIToneCurve CoreImage filter
CITorusLensDistortionProduces an effect as if a toroidal lens were placed on the input image.
CITransitionFilterA CITransitionFilter that animates a transition between two images.
CITriangleKaleidoscopeA CIFilter that creates a kaleidoscopic effect.
CITriangleTileTiles the image with a triangular region of the input image.
CITwelvefoldReflectedTileA CITileFilter that applies 12-way reflected symmetry.
CITwirlDistortionA CIDistortionFilter that rotates pixels around a point.
CIUIParameterSetContains options for core image filter user interfaces.
CIUnsharpMaskA CIFilter that increases the contrast of edges in the image.
CIVectorA vector for use with Core Image objects such as CIFilter.
CIVibranceThe CIVibrance CoreImage filter
CIVignetteThe CIVignette CoreImage filter
CIVignetteEffectA filter that modifies the brightness of the outside of an image.
CIVortexDistortionA CIDistortionFilter that creates a tight spiraling distortion suggestive of a vortex.
CIWarpKernelA kernel for GPU transforms that operate only on geometry.
CIWhitePointAdjustThe CIWhitePointAdjust CoreImage filter
CIZoomBlurApplies a blur that simulates a camera zoom during capture.
FaceDetectorAccuracyAn enumeration whose values specify the accuracy of face detection.
ICIFilterConstructorInterface for classes that create named filters.