<!--
{
  "documentType" : "article",
  "framework" : "Accelerate",
  "identifier" : "/documentation/Accelerate/creating-vimage-pixel-buffers",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "Creating vImage pixel buffers"
}
-->

# Creating vImage pixel buffers

Allocate and initialize pixel buffers from raw pixel data, Core Graphics images, and Core Video buffers.

## Topics

### Creating a pixel buffer

[`init(size: vImage.Size, pixelFormat: Format.Type)`](/documentation/Accelerate/vImage/PixelBuffer/init(size:pixelFormat:)-12gl9)

Returns a new multiplane pixel buffer with a size that you specify.

[`init(size: vImage.Size, pixelFormat: Format.Type)`](/documentation/Accelerate/vImage/PixelBuffer/init(size:pixelFormat:)-96ocu)

Returns a new pixel buffer with a size that you specify.

[`init(width: Int, height: Int, pixelFormat: Format.Type)`](/documentation/Accelerate/vImage/PixelBuffer/init(width:height:pixelFormat:))

Returns a new pixel buffer with a width and height that you specify.

[`struct Size`](/documentation/Accelerate/vImage/Size)

A structure that contains width and height values.

### Creating a pixel buffer from raw pixel data

[`init<U>(pixelValues: U, size: vImage.Size, pixelFormat: Format.Type)`](/documentation/Accelerate/vImage/PixelBuffer/init(pixelValues:size:pixelFormat:))

Creates a new pixel buffer by copying the supplied collection of pixel values.

[`init(data: UnsafeMutableRawPointer, width: Int, height: Int, byteCountPerRow: Int, pixelFormat: Format.Type)`](/documentation/Accelerate/vImage/PixelBuffer/init(data:width:height:byteCountPerRow:pixelFormat:)-zwzz)

Returns a new buffer that references existing data.

[`init(data: UnsafeMutableRawPointer, width: Int, height: Int, byteCountPerRow: Int?, pixelFormat: Format.Type)`](/documentation/Accelerate/vImage/PixelBuffer/init(data:width:height:byteCountPerRow:pixelFormat:)-27czc)

Calculates the correct bytes per row and returns a new buffer that references existing data.

### Creating a pixel buffer from a Core Graphics image

[`init(cgImage: CGImage, cgImageFormat: inout vImage_CGImageFormat, pixelFormat: Format.Type) throws`](/documentation/Accelerate/vImage/PixelBuffer/init(cgImage:cgImageFormat:pixelFormat:))

Returns a new pixel buffer initialized from a Core Graphics image.

### Creating a pixel buffer from a Core Video buffer

[`init(copying: CVPixelBuffer, cvImageFormat: vImageCVImageFormat, cgImageFormat: inout vImage_CGImageFormat, pixelFormat: Format.Type) throws`](/documentation/Accelerate/vImage/PixelBuffer/init(copying:cvImageFormat:cgImageFormat:pixelFormat:))

Initializes a pixel buffer by copying the data from a Core Video pixel buffer.

[`init(referencing: CVPixelBuffer, converter: vImageConverter, destinationPixelFormat: Format.Type)`](/documentation/Accelerate/vImage/PixelBuffer/init(referencing:converter:destinationPixelFormat:))

Returns a new pixel buffer that references the specified Core Video pixel buffer and populated converter.

[`init(referencing: CVPixelBuffer, planeIndex: Int, overrideSize: vImage.Size?, pixelFormat: Format.Type)`](/documentation/Accelerate/vImage/PixelBuffer/init(referencing:planeIndex:overrideSize:pixelFormat:))

Initializes a pixel buffer by refencing the data from a single plane of a multiplane Core Video pixel buffer.

### Creating a multiple-plane buffer from an interleaved buffer

[`init(interleavedBuffer: vImage.PixelBuffer<vImage.Interleaved8x3>)`](/documentation/Accelerate/vImage/PixelBuffer/init(interleavedBuffer:)-9xct6)

Creates a 3-channel, 8-bit-per-channel multiple-plane buffer from a 3-channel, 8-bit-per-channel interleaved buffer.

[`init(interleavedBuffer: vImage.PixelBuffer<vImage.Interleaved8x4>)`](/documentation/Accelerate/vImage/PixelBuffer/init(interleavedBuffer:)-8f6xn)

Creates a 4-channel, 8-bit-per-channel mutiple-plane buffer from a 4-channel, 8-bit-per-channel interleaved buffer.

[`init(interleavedBuffer: vImage.PixelBuffer<vImage.InterleavedFx3>)`](/documentation/Accelerate/vImage/PixelBuffer/init(interleavedBuffer:)-77n3i)

Creates a 3-channel, 32-bit-per-channel multiple-plane buffer from a 3-channel, 32-bit-per-channel interleaved buffer.

[`init(interleavedBuffer: vImage.PixelBuffer<vImage.InterleavedFx4>)`](/documentation/Accelerate/vImage/PixelBuffer/init(interleavedBuffer:)-2hc6f)

Creates a 4-channel, 32-bit-per-channel multiple-plane buffer from a 4-channel, 32-bit-per-channel interleaved buffer.

### Creating an interleaved buffer from another buffer

[`init(planarBuffers: [vImage.PixelBuffer<vImage.Planar8>])`](/documentation/Accelerate/vImage/PixelBuffer/init(planarBuffers:)-727d)

Creates a 2-channel, 8-bit-per-channel interleaved buffer from two 8-bit planar buffers.

[`init(planarBuffers: [vImage.PixelBuffer<vImage.Planar8>])`](/documentation/Accelerate/vImage/PixelBuffer/init(planarBuffers:)-6r9p0)

Creates a 3-channel, 8-bit-per-channel interleaved buffer from three 8-bit planar buffers.

[`init(planarBuffers: [vImage.PixelBuffer<vImage.Planar8>])`](/documentation/Accelerate/vImage/PixelBuffer/init(planarBuffers:)-6hkso)

Creates a 4-channel, 8-bit-per-channel interleaved buffer from four 8-bit planar buffers.

[`init(planarBuffers: [vImage.PixelBuffer<vImage.PlanarF>])`](/documentation/Accelerate/vImage/PixelBuffer/init(planarBuffers:)-8nt2j)

Creates a 4-channel, 8-bit-per-channel interleaved buffer from four 32-bit planar buffers.

[`init(planarBuffers: [vImage.PixelBuffer<vImage.PlanarF>])`](/documentation/Accelerate/vImage/PixelBuffer/init(planarBuffers:)-n2mq)

Creates a 2-channel, 32-bit-per-channel interleaved buffer from two 32-bit planar buffers.

[`init(planarBuffers: [vImage.PixelBuffer<vImage.PlanarF>])`](/documentation/Accelerate/vImage/PixelBuffer/init(planarBuffers:)-7wt24)

Creates a 3-channel, 32-bit-per-channel interleaved buffer from three 32-bit planar buffers.

[`init(planarBuffers: [vImage.PixelBuffer<vImage.PlanarF>])`](/documentation/Accelerate/vImage/PixelBuffer/init(planarBuffers:)-59s4n)

Creates a 4-channel, 32-bit-per-channel interleaved buffer from four 32-bit planar buffers.

[`init(planarBuffers: [vImage.PixelBuffer<vImage.Planar16U>])`](/documentation/Accelerate/vImage/PixelBuffer/init(planarBuffers:)-2575t)

Creates a 4-channel, 16-bit-per-channel interleaved buffer from four 16-bit planar buffers.

[`init(lumaSource: vImage.PixelBuffer<vImage.Planar8>, chromaSource: vImage.PixelBuffer<vImage.Interleaved8x2>, conversionInfo: vImage_YpCbCrToARGB)`](/documentation/Accelerate/vImage/PixelBuffer/init(lumaSource:chromaSource:conversionInfo:))

Creates a 4-channel, 8-bit-per-channel interleaved buffer from a planar Yp buffer and a two-channel interleaved CbCr buffer.

[`init(interleavedBuffer: vImage.PixelBuffer<vImage.Interleaved8x4>)`](/documentation/Accelerate/vImage/PixelBuffer/init(interleavedBuffer:)-35or3)

Creates a 4-channel, 32-bit-per-channel interleaved buffer from a 4-channel, 8-bit-per-channel interleaved buffer.

### Creating a multiple-plane buffer from planar buffers

[`init(planarBuffers: [vImage.PixelBuffer<Format.PlanarPixelFormat>], pixelFormat: Format.Type)`](/documentation/Accelerate/vImage/PixelBuffer/init(planarBuffers:pixelFormat:))

Returns an initialized buffer by copying the specified planar buffers.

### Creating a pixel buffer and image format

[`static func makeDynamicPixelBufferAndCGImageFormat(cgImage: CGImage) throws -> (pixelBuffer: vImage.PixelBuffer<vImage.DynamicPixelFormat>, cgImageFormat: vImage_CGImageFormat)`](/documentation/Accelerate/vImage/PixelBuffer/makeDynamicPixelBufferAndCGImageFormat(cgImage:))

Returns a new dynamic pixel format pixel buffer and Core Graphics image format structure from a Core Graphics image.

[`static func makePixelBufferAndCGImageFormat(cgImage: CGImage, pixelFormat: Format.Type) throws -> (pixelBuffer: vImage.PixelBuffer<Format>, cgImageFormat: vImage_CGImageFormat)`](/documentation/Accelerate/vImage/PixelBuffer/makePixelBufferAndCGImageFormat(cgImage:pixelFormat:))

Returns a new pixel buffer and Core Graphics image format structure from a Core Graphics image.



---

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)