<!--
{
  "availability" : [
    "iOS: 9.0.0 -",
    "iPadOS: 9.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.4.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreImage",
  "identifier" : "/documentation/CoreImage/CISampler/samplerWithImage:keysAndValues:",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Core Image"
    ],
    "preciseIdentifier" : "c:objc(cs)CISampler(cm)samplerWithImage:keysAndValues:"
  },
  "title" : "samplerWithImage:keysAndValues:"
}
-->

# samplerWithImage:keysAndValues:

Creates and returns a sampler that references an image using options specified as key-value pairs.

```
+ (instancetype) samplerWithImage:(CIImage *) im keysAndValues:(id) key0;
```

## Parameters

`im`

The image that you want the sampler to reference.

`key0`

A list of key-value pairs that represent options.  Each key needs to be followed by that appropriate value. You can supply one or more key-value pairs. Use `nil` to specify the end of the key-value options. See [Sampler Option Keys](/documentation/CoreImage/sampler-option-keys).

## Return Value

A sampler that references the image specified by the `im` argument and uses the specified options.

---

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)