<!--
{
  "availability" : [
    "iOS: 17.0.0 -",
    "iPadOS: 17.0.0 -",
    "macCatalyst: -",
    "macOS: 14.0.0 -",
    "tvOS: 17.0.0 -",
    "visionOS: -",
    "watchOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Accelerate",
  "identifier" : "/documentation/Accelerate/vImage/PixelBuffer/applyLookup(alphaTable:redTable:greenTable:blueTable:destination:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Accelerate"
    ],
    "preciseIdentifier" : "s:10Accelerate6vImageO11PixelBufferVAaC14Interleaved8x4VRszrlE11applyLookup10alphaTable03redI005greenI004blueI011destinationySays5UInt8VGSg_A3qEy_AGGtF"
  },
  "title" : "applyLookup(alphaTable:redTable:greenTable:blueTable:destination:)"
}
-->

# applyLookup(alphaTable:redTable:greenTable:blueTable:destination:)

Applies a set of four lookup tables to transform an interleaved, four-channel 8-bit image.

```
func applyLookup(alphaTable: [Pixel_8]?, redTable: [Pixel_8]?, greenTable: [Pixel_8]?, blueTable: [Pixel_8]?, destination: vImage.PixelBuffer<vImage.Interleaved8x4>)
```

## Parameters

`alphaTable`

A lookup table for the alpha channel that contains 256 [`Pixel_8`](/documentation/Accelerate/Pixel_8) values. Pass `nil` to specify that the function copies the alpha channel unchanged to the destination buffer.

`redTable`

A lookup table for the red channel that contains 256 [`Pixel_8`](/documentation/Accelerate/Pixel_8) values. Pass `nil` to specify that the function copies the red channel unchanged to the destination buffer.

`greenTable`

A lookup table for the green channel that contains 256 [`Pixel_8`](/documentation/Accelerate/Pixel_8) values. Pass `nil` to specify that the function copies the green channel unchanged to the destination buffer.

`blueTable`

A lookup table for the blue channel that contains 256 [`Pixel_8`](/documentation/Accelerate/Pixel_8) values. Pass `nil` to specify that the function copies the blue channel unchanged to the destination buffer.

`destination`

The destination pixel buffer.

## Discussion

Use this function to apply individual lookup tables to each channel in an interleaved, four-channel image. Adjust the order of the tables for images that don’t use ARGB channel ordering. For example, use the `blueTable` parameter for the alpha lookup table to transform an RGBA image.

The following code creates a simple lookup table that transforms a [`vImage.Interleaved8x4`](/documentation/Accelerate/vImage/Interleaved8x4) pixel buffer into its negative. For example, when an input pixel has the value `255, 255, 255, 255`, the output pixel has the value `0, 0, 0, 0`. Conversely, when an input pixel has the value `0, 0, 0, 0`, the output pixel has the value `255, 255, 255, 255`:

```swift
let lookup: [Pixel_8] = (0 ..< 256).map { i in
    Pixel_8(255 - i)
}

let destinationBuffer = vImage.PixelBuffer(
    size: sourceBuffer.size,
    pixelFormat: vImage.Interleaved8x4.self)

sourceBuffer.applyLookup(alphaTable: nil,
                         redTable: lookup,
                         greenTable: lookup,
                         blueTable: lookup,
                         destination: destinationBuffer)
```

The images below show an example source image on the left and the negative result on the right.

![Two versions of a close-up image of a fruit tree. On the left is the original color image, and on the right is the transformed, negative image with its colors inverted.](images/com.apple.accelerate/media-4165177@2x.png)

---

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)