I've been trying to cut a picture into several parts for hours now.
I thought it would work with ImageEditor.cropImage
. Apparently I'm using the function wrong, or it doesn't do what I expect it to do.
Can someone please tell me what I'm doing wrong, or recommend a package I can use. Thank you.
My attempt:
const cropData = {
offset: {x: 25, y: 25},
size: {width: 250, height: 250},
displaySize: {width: 250, height: 250},
resizeMode: 'contain',
};
later..
ImageEditor.cropImage(require('../resources/images/pictures/categoryOne/c1b1.jpg'),
cropData);
I solved my issue not with ImageEditor.cropImage but with CSS
<View style={styles.topLeftView}>
<Image
style={styles.topLeftImage}
source={require('../resources/images/pictures/categoryOne/c1b1.jpg')}
resizeMode="contain"
/>
</View>
Style
topLeftView: {
width: 100,
height: 100,
overflow: 'hidden',
},
topLeftImage: {
right: 0,
bottom: 0,
},