Preparing search index...

    Function cropImage

    • Opens the cropping interface for an existing image

      Allows users to manually crop an existing image file. Useful for editing images that have already been selected or captured.

      Android: returns the cropper output directly, which uCrop already writes at full resolution with any rotation applied.

      iOS: react-native-image-crop-picker always scales the crop to fit width x height (200x200 by default). Requesting a box equal to the source size means an untouched crop is returned with its exact pixels, the cropper opens on the full image (the box also sets its initial aspect), a partial crop is upscaled once to the source frame, a 90-degree rotated crop is shrunk to fit, and memory never exceeds the source size. When the source size cannot be read, the cropper opens without a box and the output may have a lower resolution.

      Parameters

      • uri: string

        File path or URI of the image to crop

      • themeColors: MD3Colors

        React Native Paper theme colors for UI consistency

      • OptionalknownSize: ImageSize

        Oriented pixel size of the image when already known, skips reading it on iOS

      Returns Promise<string>

      Promise resolving to the file path of cropped image, or empty string if cancelled

      const { colors } = useTheme();
      const existingImagePath = "file:///path/to/image.jpg";
      const croppedPath = await cropImage(existingImagePath, colors);

      if (croppedPath) {
      console.log(`Image cropped: ${croppedPath}`);
      // Use the cropped image
      } else {
      console.log('User cancelled cropping');
      }