---
title: "extractChannel(at:destination:)"
framework: accelerate
role: symbol
role_heading: Instance Method
path: "accelerate/vimage/pixelbuffer/extractchannel(at:destination:)-i1zm"
---

# extractChannel(at:destination:)

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

## Declaration

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

## Parameters

- `channelIndex`: The index of the channel that the function extracts.
- `destination`: The destination pixel buffer.

## Discussion

Discussion For example, the following code extracts channel `2` from a four-channel pixel buffer. let src = vImage.PixelBuffer<vImage.Interleaved16Ux4>(     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.Planar16U>(     size: src.size)

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

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

## See Also

### Extracting Channels

- [extractChannel(at:destination:)](accelerate/vimage/pixelbuffer/extractchannel(at:destination:)-ageg.md)
- [extractChannel(at:destination:)](accelerate/vimage/pixelbuffer/extractchannel(at:destination:)-8xrq1.md)
