Using the image
A capture resolves to a nitro-ui-renderer Image (imported as a type from nitro-ui-renderer/hybrids). This page covers the methods you will reach for after a capture; the full class is documented by NitroUI.
import type { Image } from 'nitro-ui-renderer/hybrids'
Display it
Pass the Image to NitroUI's Image component. width / height gives the aspect ratio:
<Image
image={shot}
resizeMode="contain"
layout={{ width: 300, aspectRatio: shot.width / shot.height }}
/>
Encode it
const png = await image.toEncodedImageDataAsync('png')
const jpeg = await image.toEncodedImageDataAsync('jpg', 80)
// png.buffer: ArrayBuffer of the encoded file
quality runs from 0 to 100, defaults to 100, and is ignored for PNG. Values outside 0...100 throw.
:::info JPEG drops alpha
Captures keep transparency. Encode as PNG to keep it, or give the captured view a background before encoding as JPEG.
:::
Base64
const base64 = await image.toBase64Async('png')
const dataUrl = `data:image/png;base64,${base64}`
The string is standard padded Base64 without a data-URL prefix.
Save to a file
const path = await image.saveToTemporaryFileAsync('png')
await image.saveToFileAsync('/path/to/shot.jpg', 'jpg', 80)
Paths are filesystem paths, not URLs: prepend file:// when another API needs one.
Read pixels
const raw = await image.toRawPixelDataAsync()
const bytes = new Uint8Array(raw.buffer)
Always read raw.pixelFormat instead of assuming a byte order: it is typically 'BGRA' on iOS and 'RGBA' on Android. The native tests map each format to channel offsets before reading a pixel.
Transform it
resize, crop, rotate, mirrorHorizontally and renderInto return new Images and each has an Async variant:
const thumbnail = await image.resizeAsync(image.width / 4, image.height / 4)