Quantcast
Channel: Active questions tagged react-native+ios - Stack Overflow
Viewing all articles
Browse latest Browse all 16552

Cropped image is very small in react-native

$
0
0

I would like to crop my image and I used @react-native-community/image-editor I want to crop the image from the base64 image so I used RNFetchBlob too. Here is my code.

const file_path =
      RNFetchBlob.fs.dirs.DocumentDir + '/' + new Date().getTime() + '.jpg';
RNFetchBlob.fs
      .writeFile(file_path, this.state.image, 'base64')
      .then(res => {
        console.log(res);
        ImageEditor.cropImage(
          'file:///' + file_path,
          {
            offset: {x: topX, y: topY},
            size: {width: bottomX - topX, height: bottomY - topY},
            displaySize: {width: bottomX - topX, height: bottomY - topY},
          },
          'PNG',
        ).then(url => {
          console.log(url);
          this.setState({visible: true, cropedImage: url});
        });
      });

It's working on Android but in iOS it's very small like 20*20 pixel even I set the size as more than 1000 pixel. I should upload cropped image to the server so I need the file of the cropped image. Thank you for your answer.


Viewing all articles
Browse latest Browse all 16552

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>