react-native-image-resizer
react-native-image-resizer copied to clipboard
The size of the image is changed after rotation (only on Android)
When I rotate the image, the rotated image size has changed, normally the rotation should not affect the image size. It works fine in IOS.
original image before rotation:
width: 512
height: 628
image after rotation:
width: 500
height: 408
the code:
onRotateImage = () => {
const layer = this.props.layer;
const img = layer.image;
ImageResizer.createResizedImage(`file://${img.url}`, 500, 500, 'JPEG', 100, (img.rotate + 270) % 360, undefined, true)
.then((response) => {
img.thumbnail_url = `file://${response.path}`;
// the issue is here
img.width = response.width;
img.height = response.height;
img.rotate = (img.rotate + 270) % 360;
this.props.layer.image = img;
})
.catch(err => {
console.error('[TemplateImageModal] Unable to resize camera image: ', err);
});
}