<!--
{
  "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/overwriteChannels(_:withInterleavedBuffer:destination:)-74hah",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Accelerate"
    ],
    "preciseIdentifier" : "s:10Accelerate6vImageO11PixelBufferVAaC14Interleaved8x4VRszrlE17overwriteChannels_015withInterleavedD011destinationySays5UInt8VG_AEy_AGGANtF"
  },
  "title" : "overwriteChannels(_:withInterleavedBuffer:destination:)"
}
-->

# overwriteChannels(_:withInterleavedBuffer:destination:)

Overwrites the pixels of one or more channels of the pixel buffer with the provided 8-bit interleaved pixel buffer.

```
func overwriteChannels(_ channels: [UInt8], withInterleavedBuffer buffer: vImage.PixelBuffer<Format>, destination: vImage.PixelBuffer<Format>)
```

## Parameters

`channels`

An array that contains the indices of the channels that the function overwrites.

`buffer`

The planar buffer that the function writes to the channels.

`destination`

The destination pixel buffer.

## Discussion

Use this function to overwrite one or more channels of an interleaved buffer with an interleaved buffer. The following code overwrites channels `1` and `3` with the values in `overwriteValues`:

```swift
let pixelValues: [Pixel_8] = [ 1, 2, 3, 4,
                               5, 6, 7, 8 ]
let buffer = vImage.PixelBuffer(pixelValues: pixelValues,
                                size: vImage.Size(width: 1,
                                                  height: 2),
                                pixelFormat: vImage.Interleaved8x4.self)

let destination = vImage.PixelBuffer(size: vImage.Size(width: 1,
                                                       height: 2),
                                     pixelFormat: vImage.Interleaved8x4.self)

let overwriteValues: [Pixel_8] = [ 101, 102, 103, 104,
                                   105, 106, 107, 108]

let overwriteBuffer = vImage.PixelBuffer<vImage.Interleaved8x4>(pixelValues: overwriteValues,
                                                                size: vImage.Size(width: 1,
                                                                                  height: 2))

buffer.overwriteChannels([3, 1],
                         withInterleavedBuffer: overwriteBuffer,
                         destination: destination)
```

On return, `destination.array` contains the following values:

```swift
[ 1, 102, 3, 104,  
  5, 106, 7, 108 ]
```

---

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)