What is the output of running npx envinfo --binaries --languages --system --utilities?
System:
OS: Windows 10 10.0.18363
CPU: (4) x64 Intel(R) Core(TM) i5-6300HQ CPU @ 2.30GHz
Memory: 4.79 GB / 11.90 GB
Binaries:
Node: 10.17.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.19.1 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 6.11.3 - C:\Program Files\nodejs\npm.CMD
Utilities:
Git: 2.23.0. - /mingw64/bin/git
Languages:
Bash: 4.4.23 - C:\Program Files\Git\usr\bin\bash.EXE
Java: 1.8.0_131 - /c/Program Files/Java/jdk1.8.0_131/bin/javac
Perl: 5.26.2 - C:\Program Files\Git\usr\bin\perl.EXE
Python: 3.5.3 - /c/Users/***/AppData/Local/Programs/Python/Python35/python
What are the steps to reproduce?

.resize(metadata.width / 2, metadata.height / 2) to resize the image.rotate() to auto-rotate the image based on the EXIF data.toFile('your-path') to export to the file.
What is the expected behaviour?
.rotate() should rotate the whole image including width height. The result should look like this:
Are you able to provide a standalone code sample, without other dependencies, that demonstrates this problem?
const sharpImage = sharp('./input.jpg', { sequentialRead: true });
const metadata = await sharpImage.metadata();
const resizedImage = sharpImage.resize(metadata.width / 2, metadata.height / 2);
const rotatedImage = resizedImage.rotate();
const output = await rotatedImage.toFile('./output.jpg');
Hi, you'll need to break this into two pipelines:
const resizedImage = await sharpImage.resize(metadata.width / 2, metadata.height / 2).toBuffer();
const rotatedImage = sharp(resizedImage).rotate();
For the specific case of halving the dimensions, there's been some previous discussion about an explicit scale option at https://github.com/lovell/sharp/issues/236#issuecomment-305184672
@lovell: It works perfectly. Thank you so much!!!
Added:
We should have .withMetadata() in the first pipeline to keep EXIF data for the second pipeline. Otherwise, the second pipeline won't auto-rotate the image.
Thus, the code should be:
const resizedImage = await sharpImage.resize(metadata.width / 2, metadata.height / 2).withMetadata().toBuffer();
const rotatedImage = sharp(resizedImage).rotate();
Most helpful comment
Hi, you'll need to break this into two pipelines:
For the specific case of halving the dimensions, there's been some previous discussion about an explicit
scaleoption at https://github.com/lovell/sharp/issues/236#issuecomment-305184672