PictureOptions
Tunes a picture a Camera takes: its JPEG quality, and whether its bytes come back with it.
Verwendung
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>
</>
);
}Typdeklaration
export type PictureOptions = SpecPictureOptions;Mitglieder 2
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
quality | number | Nein | JPEG quality from 0 to 1; 1 by default. |
bytes | boolean | Nein | Also return the JPEG's bytes. |
Generiert aus den öffentlichen TypeScript-Deklarationen: Signaturen, Props und Standardwerte stammen aus der geprüften Quelle, Beschreibungen aus deren JSDoc. Kein Standardwert ist erfunden.