Contents

documentEnhancer()

Adjusts an image’s shadows and contrast.

Declaration

class func documentEnhancer() -> any CIFilter & CIDocumentEnhancer

Return Value

The modified image.

Discussion

This method applies the document enhancer filter to an image. The effect removes unwanted shadows while whitening the background and enhancing contrast. The filter is commonly used to enhance scanned documents.

The document enhancer filter uses the following properties:

inputImage

An image with the type CIImage.

amount

A float representing the desired strength of the effect as an NSNumber.

The following code creates a filter that adds brightness to the input image:

func documentEnhancer(inputImage: CIImage) -> CIImage {
    let documentEnhancerFilter = CIFilter.documentEnhancer()
    documentEnhancerFilter.inputImage = inputImage
    documentEnhancerFilter.amount = 4
    return documentEnhancerFilter.outputImage!
}

[Image]

See Also

Color Effect Filters