<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: -",
    "macOS: 13.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: -",
    "watchOS: 9.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Accelerate",
  "identifier" : "/documentation/Accelerate/vImage/PixelBuffer/extractChannel(at:destination:)-ageg",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Accelerate"
    ],
    "preciseIdentifier" : "s:10Accelerate6vImageO11PixelBufferVAaC14Interleaved8x4VRszrlE14extractChannel2at11destinationySi_AEy_AC7Planar8VGtF"
  },
  "title" : "extractChannel(at:destination:)"
}
-->

# extractChannel(at:destination:)

Extracts a single channel from an 8-bit-per-channel, 4-channel interleaved pixel buffer.

```
func extractChannel(at channelIndex: Int, destination: vImage.PixelBuffer<vImage.Planar8>)
```

## Parameters

`channelIndex`

The index of the channel that the function extracts.

`destination`

The destination pixel buffer.

## Discussion

For example, the following code extracts channel `2` from a four-channel pixel buffer.

```swift
let src = vImage.PixelBuffer<vImage.Interleaved8x4>(
    pixelValues: [10, 11, 12, 13,
                  20, 21, 22, 23,
                  30, 31, 32, 33],
    size: vImage.Size(width: 1, height: 3))

let dest = vImage.PixelBuffer<vImage.Planar8>(
    size: src.size)

src.extractChannel(at: 2,
                   destination: dest)

// Prints "[12, 22, 32]".
print(dest.array)
```

---

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)