<!--
{
  "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/temporarySurface(identifier:format:width:height:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Core Image"
    ],
    "preciseIdentifier" : "c:objc(pl)CIImageProcessorOutput(im)temporarySurfaceWithIdentifier:format:width:height:"
  },
  "title" : "temporarySurface(identifier:format:width:height:)"
}
-->

# temporarySurface(identifier:format:width:height:)

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

```
func temporarySurface(identifier: String, format: OSType, width: Int, height: Int) -> IOSurface?
```

## Parameters

`identifier`

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

`format`

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

`width`

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

`height`

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

## Return Value


An autoreleased `IOSurface` of the requested size and format, or `nil` if the surface could not be created.

## Discussion

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

The returned surface 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 the same surface. Otherwise it returns a distinct surface.
This lets a processor request several independent surfaces 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)