-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
Possible bug
Is this a possible bug in a feature of sharp, unrelated to installation?
- Running
npm install sharpcompletes without error. - Running
node -e "require('sharp')"completes without error.
Are you using the latest version of sharp?
- I am using the latest version of
sharpas reported bynpm view sharp dist-tags.latest.
What is the output of running npx envinfo --binaries --system --npmPackages=sharp --npmGlobalPackages=sharp?
System:
OS: macOS 12.6
CPU: (10) arm64 Apple M1 Pro
Memory: 884.92 MB / 32.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 18.7.0 - ~/.nvm/versions/node/v18.7.0/bin/node
Yarn: 1.22.19 - ~/.yarn/bin/yarn
npm: 8.15.0 - ~/.nvm/versions/node/v18.7.0/bin/npm
npmPackages:
sharp: 0.31.1 => 0.31.1
What are the steps to reproduce?
- Load an image with an EXIF orientation tag such as 4, 5 or 7
- Call
.rotate()on the pipeline - Output the image using
toFile() - Observe the lack of auto-rotation
What is the expected behaviour?
The images should be automatically rotated based on their exif orientation tag.
(According to the documentation; Rotate the output image by either an explicit angle or auto-orient based on the EXIF Orientation tag.)
All of these images have an exif orientation, but are not automatically oriented. If you add a resize(200, 200) call to the pipeline, it will however rotate them correctly.
Please provide a minimal, standalone code sample, without other dependencies, that demonstrates this problem
Download source images from here: https://timely-scone-c18287.netlify.app/images.zip
(They are also available as https://timely-scone-c18287.netlify.app/input-orientation1.jpg through 8)
const sharp = require('sharp')
async function run() {
for (let i = 1; i <= 8; i++) {
sharp(`./input-orientation${i}.jpg`)
.rotate()
.png()
.toFile(`output-orientation${i}.png`)
}
}
run()Please provide sample image(s) that help explain this problem
(provided as links in order for GitHub not to alter image and adjust any exif data)
https://timely-scone-c18287.netlify.app/input-orientation4.jpg
https://timely-scone-c18287.netlify.app/input-orientation5.jpg
https://timely-scone-c18287.netlify.app/input-orientation7.jpg