<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "macCatalyst: 27.0.0 -",
    "macOS: 27.0.0 -",
    "tvOS: 27.0.0 -",
    "visionOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreImage",
  "identifier" : "/documentation/CoreImage/CIImageProcessorOutput/temporaryPixelBuffer(identifier:format:width:height:attributes:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Core Image"
    ],
    "preciseIdentifier" : "c:objc(pl)CIImageProcessorOutput(im)temporaryPixelBufferWithIdentifier:format:width:height:attributes:"
  },
  "title" : "temporaryPixelBuffer(identifier:format:width:height:attributes:)"
}
-->

# temporaryPixelBuffer(identifier:format:width:height:attributes:)

Returns a temporary CVPixelBuffer that your Core Image Processor Kernel can use as scratch storage during processing.

```
func temporaryPixelBuffer(identifier: String, format: OSType, width: Int, height: Int, attributes: [AnyHashable : Any]? = nil) -> CVPixelBuffer?
```

## Parameters

`identifier`

A name that uniquely identifies this scratch buffer within the processor invocation.

`format`

The pixel format for the buffer. Must be a non-zero `OSType` pixel format constant.

`width`

The width of the buffer in pixels. Must be greater than zero.

`height`

The height of the buffer in pixels. Must be greater than zero.

`attributes`

An optional dictionary of `CVPixelBuffer` creation attributes.

## Return Value


A non-retained `CVPixelBuffer` of the requested size and format, or `nil` if the buffer could not be created.

## Discussion

Use this method when your processor needs an intermediate `CVPixelBuffer` to stash data between stages of its work.
Core Image manages the lifetime of the returned buffer and reuses the underlying allocation across multiple invocations
when possible. This is more efficient than allocating a fresh `CVPixelBuffer` on each invocation of your processor.

The returned pixel buffer is valid only for the duration of the
[`process(with:arguments:output:)`](/documentation/CoreImage/CIImageProcessorKernel/process(with:arguments:output:)) call that requested it.
Don’t retain it beyond the scope of that method or use it after the method returns.

Calling this method multiple times within the same processor invocation with the same `identifier`, `format`,
`width`, and `height` returns a pixel buffer backed by the same `IOSurface`. Otherwise it returns a distinct pixel buffer.
This lets a processor request several independent pixel buffers by giving each one a unique name.

---

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)