Cropping not correct
See original GitHub issuereact-native: 0.60.5 react-native-perspective-image-cropper": "^0.4.4
Original:
Selected coords:
Result:
constructor(props) {
super(props)
this.state = {
enableExtract: false,
}
this.updateImage = this.updateImage.bind(this)
this.crop = this.crop.bind(this)
}
componentDidMount() {
let image = this.props.navigation.getParam('image')
Image.getSize(image, (width, height) => {
this.setState({
imageWidth: width,
imageHeight: height,
initialImage: image,
rectangleCoordinates: {
topLeft: { x: 50, y: 50 },
topRight: { x: 50, y: 50 },
bottomRight: { x: 50, y: 50 },
bottomLeft: { x: 50, y: 50 },
}
})
})
}
updateImage(image, newCoordinates) {
this.setState(
{
image,
rectangleCoordinates: newCoordinates,
},
() => {
this.props.navigation.navigate('CropResult', { cropImage: this.state.image })
}
)
}
crop() {
this.customCrop.crop()
}
<CustomCrop
updateImage={this.updateImage}
rectangleCoordinates={this.state.rectangleCoordinates}
initialImage={this.state.initialImage}
height={this.state.imageHeight}
width={this.state.imageWidth}
ref={(ref) => {
this.customCrop = ref
}}
overlayColor="rgba(18,190,210, 1)"
overlayStrokeColor="rgba(20,190,210, 1)"
handlerColor="rgba(20,150,160, 1)"
enablePanStrict={false}
/>
Any idea how to fix this?
Issue Analytics
- State:
- Created 4 years ago
- Comments:11
Top Results From Across the Web
Microsoft Photo Cropping Not Working 3/31/17
Now the cropping option is not working right. Basically, you can't affect just one edge of the photo without affecting an adjoining edge....
Read more >Cropping Image is not cropping correctly - Stack Overflow
I do not understand - the rectangle marked in Red does not crop the image correctly? - it shows different area of the...
Read more >Crop Tool Not Working Properly. - Adobe Support Community
Solved: I've noticed that when cropping or rotating in PS 2020 the app goes haywire and often shows a little countdown timer like...
Read more >Cropping not working : r/CapCut - Reddit
Cropping not working. When I crop a video and hit the tick I doesn't change the way it looks to how I made...
Read more >Your Master Guide to Cropping and Resizing Images - BeFunky
Not knowing when to crop photos and when to resize images can yield a dull ... in the Crop tool's drop-down menu to...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I faced the same issue and since no one replied i tried to fix it myself and after many hours of trial and error i did managed to fix it and enhanced the usage, use this modified component for testing
react-native-perspective-image-cropper.zip
Make sure to change android/settings.gradle to point to the folder where you have pasted the component for e.g
include ':rreact-native-perspective-image-cropper' project(':react-native-perspective-image-cropper').projectDir = new File(rootProject.projectDir, '../src/components/react-native-document-scanner/android')
and change import statement to
import CustomCrop from "../../components/react-native-perspective-image-cropper"
If your issue is fixed as well, i can make a PR
@maknom66 IOS still same issue please help.