PictureOptions
Tunes a picture a Camera takes: its JPEG quality, and whether its bytes come back with it.
Usage
Choose capture quality and output.
// Choose capture quality and output.
import { Button, Camera, cameraRef, fileSystem, type PictureOptions } from 'kuito';
// Smaller files for an upload, with the bytes in memory so nothing reads the file again.
const forUpload: PictureOptions = { quality: 0.6, bytes: true };
function Uploader() {
const camera = cameraRef();
const send = async () => {
const picture = await camera.current?.takePicture(forUpload);
if (!picture?.bytes) return;
await fetch('https://api.example.com/photos', { method: 'POST', body: picture.bytes });
await fileSystem.delete(picture.uri);
};
return (
<>
<Camera ref={camera} flex={1} />
<Button onPress={send}>Send</Button>
</>
);
}Type declaration
export type PictureOptions = SpecPictureOptions;Members 2
| Name | Type | Required | Description |
|---|---|---|---|
quality | number | No | JPEG quality from 0 to 1; 1 by default. |
bytes | boolean | No | Also return the JPEG's bytes. |
Generated from the public TypeScript declarations: signatures, props and defaults come from the checked source, descriptions from its JSDoc. No defaults are invented.