📜  世博会相机旋转 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:32.783000             🧑  作者: Mango

代码示例1
import { manipulateAsync, FlipType, SaveFormat } from 'expo-image-manipulator';

...

const takePic = async () => {
    if (!cameraRef) return;
    
    let photo = await cameraRef.takePictureAsync();

    if (cameraType === Camera.Constants.Type.front) {
        photo = await manipulateAsync(
            photo.localUri || photo.uri,
            [
                { rotate: 180 },
                { flip: FlipType.Vertical },
            ],
            { compress: 1, format: SaveFormat.PNG }
        );
    }

    setFrontProfile(photo.uri);
};