Skip to content

Resizing images taken on iOS also rotates them #2297

@rick-rheo

Description

@rick-rheo

Version 0.25.4

Images taken on iOS in portrait orientation get rotated by .resize. It doesn't matter if the image is taken directly from the camera roll or imported from the device or if the image is re-encoded by sending it via text or email. The first two images attached were retrieved with "Image Capture" app and the third was sent via email. The last three images are the output.

What are the steps to reproduce? Load one of the images attached to this bug into a Buffer then

sharp(buf).resize(256, 256).toBuffer(...

Then write that out to a file, then view that file and notice the image was not only resized, it is also rotated 270°

What is the expected behaviour?

No rotation

What is the output of running npx envinfo --binaries --system?

$ npx envinfo --binaries --system

npx: installed 1 in 1.087s

System:
OS: macOS 10.15.2
CPU: (6) x64 Intel(R) Core(TM) i5-9600K CPU @ 3.70GHz
Memory: 56.79 MB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 12.17.0 - /usr/local/bin/node
npm: 6.14.4 - /usr/local/bin/npm

though this happens running on Linux as well.

IMG_2289
FVXL1113
IMG_3085

img2289jpgcompressed-578f9d4b-5092-47c8-a057-f79094b3ff07
fvxl1113jpgcompressed-00505f9a-54c7-4767-95cb-06552100a85d
img3085jpegcompressed-f8b85e8a-b86b-4279-980a-2def317650b0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions