<!--
{
  "documentType" : "article",
  "framework" : "Accelerate",
  "identifier" : "/documentation/Accelerate/working-with-underlying-data",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "Working with underlying data"
}
-->

# Working with underlying data

Access a pixel buffer’s underlying pixel data.

## Topics

### Converting to an array

[`func makeArray<U>(of: U.Type, channelCount: Int) -> [U]`](/documentation/Accelerate/vImage/PixelBuffer/makeArray(of:channelCount:))

Returns an array of `width * height * channelCount` values that’s a copy of the buffer’s visible contents.

### Accessing underlying pixel values

[`func withUnsafeBufferPointer<R>((UnsafeBufferPointer<Format.ComponentType>) throws -> R) rethrows -> R`](/documentation/Accelerate/vImage/PixelBuffer/withUnsafeBufferPointer(_:))

Calls the given closure with a pointer to the buffer’s contiguous storage.

[`func withUnsafeMutableBufferPointer<R>((inout UnsafeMutableBufferPointer<Format.ComponentType>) throws -> R) rethrows -> R`](/documentation/Accelerate/vImage/PixelBuffer/withUnsafeMutableBufferPointer(_:))

Calls the given closure with a pointer to the buffer’s mutable contiguous storage.

### Accessing underlying vImage buffers

[`func withUnsafePointerToVImageBuffer<R>((UnsafePointer<vImage_Buffer>) throws -> R) rethrows -> R`](/documentation/Accelerate/vImage/PixelBuffer/withUnsafePointerToVImageBuffer(_:))

Calls the given closure with an unsafe pointer to the underlying vImage buffer.

[`func withUnsafeVImageBuffer<R>((vImage_Buffer) throws -> R) rethrows -> R`](/documentation/Accelerate/vImage/PixelBuffer/withUnsafeVImageBuffer(_:))

Calls the given closure with the underlying vImage buffer.

[`func withUnsafeVImageBuffers<R>(([vImage_Buffer]) throws -> R) rethrows -> R`](/documentation/Accelerate/vImage/PixelBuffer/withUnsafeVImageBuffers(_:))

Calls the given closure with the underlying vImage buffers.

### Accessing component pixel buffers

[`func withUnsafePixelBuffer<R>(at: Int, (vImage.PixelBuffer<Format.PlanarPixelFormat>) throws -> R) rethrows -> R`](/documentation/Accelerate/vImage/PixelBuffer/withUnsafePixelBuffer(at:_:))

Calls the given closure with the pixel buffer that references the individual plane at the given index.

[`func withUnsafePixelBuffers<R>(([vImage.PixelBuffer<Format.PlanarPixelFormat>]) throws -> R) rethrows -> R`](/documentation/Accelerate/vImage/PixelBuffer/withUnsafePixelBuffers(_:))

Calls the given closure with the array of pixel buffers that reference the individual planes.



---

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)