Flutter crop image like camscanner

Viewed 5035

I am working on a project where requires the image to be cropped like camscanner android native app, when a picture is taken and when user clicks the crop button, a rectangle overlay should be shown as in camscanner. Where the rectangle path can be stretched to any angle and can perform crop. Is there any library in flutter for this, actually I am looking the same functionality similar to Camscanner, image crop, image effects and converting it to pdf file.

Can anyone help me with the same?.

Thanks in advance.

2 Answers

Posting it now so that others can benefit if they come across,

[edge_detection][1] package works well,

Future<void> getImage() async {
    String? imagePath;
    // Platform messages may fail, so we use a try/catch PlatformException.
    // We also handle the message potentially returning null.
    try {
      imagePath = (await EdgeDetection.detectEdge);
      print("$imagePath");
    } on PlatformException catch (e) {
      imagePath = e.toString();
    }

    // If the widget was removed from the tree while the asynchronous platform
    // message was in flight, we want to discard the reply rather than calling
    // setState to update our non-existent appearance.
    if (!mounted) return;

    setState(() {
      _imagePath = imagePath;
      _image = _imagePath == null ? null : File(_imagePath!);
    });
  }

This function scans and detects the corner of an object which you can then crop and save in _image.

Related