Degrade the quality of an image to make it look like dated, scratchy analog film.
- Core Image
CISepia filter changes the tint of an image to a reddish-brownish hue resembling old analog photographs. You can enhance the effect by applying random specks and scratches.
The following steps leverage built-in Core Image filters to tint and texture an image to look as if it were analog film:
Create randomly varying white specks to simulate grain.
Create randomly varying dark scratches to simulate scratchy film.
Composite the speckle image and scratches onto the sepia-toned image.
Apply the Sepia Tone Filter to the Original Image
Tint the original image by applying the
The output of this filter will become the background for compositing the grain image.
Simulate Grain by Creating Randomly Varying Speckle
You can use the output of the
CIRandom filter as a basis for random noise images. Even though the noise pattern is not customizable in size, it can be extended and cropped to fit the image.
The filter takes no inputs.
Next, apply a whitening effect by chaining the noise output to a
CIColor filter. This built-in filter multiplies the noise color values individually and applies a bias to each component. For white grain, apply whitening to the y-component of RGB and no bias.
white resulting from this filter have the appearance of spotty grain when viewed as an image.
Create the grainy image by compositing the whitened noise as input over the sepia-toned source image using the
Simulate Scratch by Scaling Randomly Varying Noise
The process for applying random-looking scratches is the same as the technique used in the white grain: color the output of the
To make the speckle resemble scratches, scale the random noise output vertically by applying a scaling
Previously, you whitened the speckle image by applying the
CIColor filter evenly across all color components. For the dark scratches, instead focus on only the red component, setting the other vector inputs to zero. This time, instead of multiplying the green, blue, and alpha channels, add bias
(0, 1, 1, 1).
The resulting scratches are cyan-colored, so grayscale them using the
CIMinimum, which takes the minimum of the RGB values to produce a grayscale image.
The grayscale filter produces random lines that resemble dark scratches.
Composite the Specks and Scratches to the Sepia Image
Now that the components are set, you can add the scratches to the grainy sepia image produced earlier. However, unlike the grainy texture, the scratches impact the image multiplicatively. Instead of the
CISource filter, which composites source over background, use the
CIMultiply filter to compose the scratches multiplicatively. Set the scratched image as the filter’s input image, and tab the speckle-composited sepia image as the input background image.
Since the noise images had different dimensions than the source image, crop the composited result to the original image size to remove excess beyond the original extent.
The cropped image represents the final result: a sepia-toned image with simulated grain and scratches composited to give it an analog film appearance.