---
title: "init(pixelBuffer:)"
framework: coreml
role: symbol
role_heading: Initializer
path: "coreml/mlfeaturevalue/init(pixelbuffer:)"
---

# init(pixelBuffer:)

Creates a feature value that contains an image from a pixel buffer.

## Declaration

```swift
convenience init(pixelBuffer value: CVPixelBuffer)
```

## Parameters

- `value`: A doc://com.apple.documentation/documentation/CoreVideo/cvpixelbuffer-q2e (Swift) or doc://com.apple.documentation/documentation/CoreVideo/CVPixelBuffer (Objective-C) instance.

## Discussion

Discussion Core ML supports different pixel format types depending on the model’s feature description. For information about ImageFeatureType, see Core ML Format Reference. When the image feature’s color space is GRAYSCALE, use kCVPixelFormatType_OneComponent8; and when it’s GRAYSCALE_FLOAT16, use kCVPixelFormatType_OneComponent16Half; otherwise, use kCVPixelFormatType_32BGRA when it’s set to RGB or BGR.

## See Also

### Creating image feature values

- [init(CGImage:pixelsWide:pixelsHigh:pixelFormatType:options:)](coreml/mlfeaturevalue/init(cgimage:pixelswide:pixelshigh:pixelformattype:options:)-2zg43.md)
- [init(CGImage:orientation:pixelsWide:pixelsHigh:pixelFormatType:options:)](coreml/mlfeaturevalue/init(cgimage:orientation:pixelswide:pixelshigh:pixelformattype:options:)-4nme0.md)
- [init(CGImage:constraint:options:)](coreml/mlfeaturevalue/init(cgimage:constraint:options:)-1j00l.md)
- [init(CGImage:orientation:constraint:options:)](coreml/mlfeaturevalue/init(cgimage:orientation:constraint:options:)-87vk0.md)
- [init(imageAtURL:pixelsWide:pixelsHigh:pixelFormatType:options:)](coreml/mlfeaturevalue/init(imageaturl:pixelswide:pixelshigh:pixelformattype:options:).md)
- [init(imageAtURL:orientation:pixelsWide:pixelsHigh:pixelFormatType:options:)](coreml/mlfeaturevalue/init(imageaturl:orientation:pixelswide:pixelshigh:pixelformattype:options:).md)
- [init(imageAtURL:constraint:options:)](coreml/mlfeaturevalue/init(imageaturl:constraint:options:).md)
- [init(imageAtURL:orientation:constraint:options:)](coreml/mlfeaturevalue/init(imageaturl:orientation:constraint:options:).md)
- [MLImageConstraint](coreml/mlimageconstraint.md)
- [MLFeatureValue.ImageOption](coreml/mlfeaturevalue/imageoption.md)
