bamlab/react-native-image-resizer

The size of the image is changed after rotation (only on Android)

tiavina-mika opened this issue · 2 comments

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

image after rotation:

width: 500
height: 408
image

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);
    });
}
stale commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale commented

This issue has been automatically closed. Thank you for your contributions.