---
title: channelCount
framework: accelerate
role: symbol
role_heading: Instance Property
path: accelerate/vimage/pixelbuffer/channelcount
---

# channelCount

Returns the number of channels.

## Declaration

```swift
var channelCount: Int { get }
```

## Discussion

Discussion For example, the following code prints the number of channels in two interleaved buffers:  let x = vImage.PixelBuffer<vImage.InterleavedFx2>(size: vImage.Size(width: 1,                                                                      height: 1))  let y = vImage.PixelBuffer<vImage.Interleaved8x4>(size: vImage.Size(width: 1,                                                                      height: 1))

// Prints "2 4".  print(x.channelCount, y.channelCount)

## See Also

### Inspecting a pixel buffer

- [width](accelerate/vimage/pixelbuffer/width.md)
- [height](accelerate/vimage/pixelbuffer/height.md)
- [size](accelerate/vimage/pixelbuffer/size.md)
- [rowStride](accelerate/vimage/pixelbuffer/rowstride.md)
- [byteCountPerPixel](accelerate/vimage/pixelbuffer/bytecountperpixel.md)
- [count](accelerate/vimage/pixelbuffer/count.md)
- [array](accelerate/vimage/pixelbuffer/array.md)
