0

I am simply trying to get a square image and lower the size of the image as much a possible while keep image text clear.

This is my attempt but it does not work.

const capturePhoto = async () => {
    const options = {
      qualityPrioritization: 'speed',
      skipMetadata: true,
      flash: 'off',
      width: 500,
      height: 500,
    };

    if (camera.current !== null) {
      const photo = await camera.current.takePhoto(options);
      const {height, width, path} = photo;
      console.log(
        `The photo has a height of ${height} and a width of ${width}.`,
      );
    }
  };
Bas H
  • 2,114
  • 10
  • 14
  • 23
questerstudios
  • 111
  • 1
  • 6

1 Answers1

0

there are 2 options (or a combo of them):

check the format options and find the aspect ration & quality you want: Formats documentation or use something like expo-image-maniulator to resize.
Cropping is another thing altogether.

Phil Lucks
  • 2,704
  • 6
  • 31
  • 57
  • how do you lock aspect ratio? for example you only want the camera to have 16:9 aspect ratio and get the result of 16:9 aspect ratio? – Bryan Lumbantobing Jun 22 '23 at 13:51
  • You’ll need to filter the devices with the “format” option. Docs: https://react-native-vision-camera.com/docs/guides/formats – Phil Lucks Jun 23 '23 at 14:37