PictureOptions
Tunes a picture a Camera takes: its JPEG quality, and whether its bytes come back with it.
Utilização
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>
</>
);
}Declaração do tipo
export type PictureOptions = SpecPictureOptions;Membros 2
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
quality | number | Não | JPEG quality from 0 to 1; 1 by default. |
bytes | boolean | Não | Also return the JPEG's bytes. |
Gerado a partir das declarações TypeScript públicas: assinaturas, props e predefinições vêm da fonte verificada, as descrições da sua JSDoc. Nenhuma predefinição é inventada.