<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: 10.4.0 -",
    "tvOS: -",
    "visionOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreImage",
  "identifier" : "/documentation/CoreImage/CIFilter-swift.class/apply:",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Core Image"
    ],
    "preciseIdentifier" : "c:objc(cs)CIFilter(im)apply:"
  },
  "title" : "apply:"
}
-->

# apply:

Produces a [`CIImage`](/documentation/CoreImage/CIImage) object by applying a kernel function.

```
- (CIImage *) apply:(CIKernel *) k;
```

## Parameters

`k`

A [`CIKernel`](/documentation/CoreImage/CIKernel) object that contains a kernel function.

## Discussion

If you are implementing a custom filter, this method needs to be called from within the [`outputImage`](/documentation/CoreImage/CIFilter-swift.class/outputImage) method in order to apply your kernel function to the [`CIImage`](/documentation/CoreImage/CIImage) object. For example, if the kernel function has this signature:

```objc
kernel vec4 brightenEffect (sampler src, float k)
```

You would supply two arguments after the `k` argument  to the `apply:k, ...` method. In this case, the first argument must be a sampler and the second a floating-point value. For more information on kernels, see [Core Image Kernel Language Reference](https://developer.apple.com/library/archive/documentation/GraphicsImaging/Reference/CIKernelLangRef/Introduction/Introduction.html#//apple_ref/doc/uid/TP40004397).

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)