UnitySwiftKotlinReading this with an AI agent?Read this page as plain text instead: https://www.nianticspatial.com/docs/llms-api-swift/NSDK.CGImage.method-toYUV420PixelBuffer.txt — same content, easier to parse than this HTML.Every page in the current release follows the same pattern, so you can build the URL directly instead of fetching an index: a page at /api/swift/<page>/ is at /llms-api-swift/<page>.txt.For every page in this section, read https://www.nianticspatial.com/docs/llms-api-swift.txt; for every section of these docs, read https://www.nianticspatial.com/docs/llms.txt.←API Reference Return to API Reference index←packageNSDK NSDK←extensionCGImage CGImage Method toYUV420PixelBuffer toYUV420PixelBuffer Declaration func toYUV420PixelBuffer(width: Int, height: Int) -> CVPixelBuffer? Summary Converts the CGImage to a CVPixelBuffer in YUV420NV12 (bi-planar) format for use as a camera feed. Uses Core Image to perform the color conversion. Returns nil if buffer creation or render fails. Parameters NameTypeSummarywidthIntTarget width for the pixel buffer (typically the image width).heightIntTarget height for the pixel buffer (typically the image height).
Converts the CGImage to a CVPixelBuffer in YUV420NV12 (bi-planar) format for use as a camera feed.
Uses Core Image to perform the color conversion. Returns nil if buffer creation or render fails.