question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unexpected image rotation during resize

See original GitHub issue

My generated images are always “horizontal” (larger in width) even when the input was “vertical” – for instance, an upright phone picture.

My resize code is basically:

sharp(originalImagePath)
    .resize(200, 200) // to make a small thumbnail
    .min()
    .toFile(outputImagePath);

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

16reactions
lovellcommented, Nov 5, 2020

“If no angle is provided, it is determined from the EXIF data.”

If there’s no EXIF data, or if the EXIF data states there should be no rotation, then none will occur for a parameter-less call to rotate().

0reactions
avichal-neweradevelopercommented, Jul 19, 2021

@lovell rotate() works but it is increasing my buffer size a few times

Read more comments on GitHub >

github_iconTop Results From Across the Web

Some images are being rotated when resized - Stack Overflow
An image that rotates/flips will do so consistently, and in the same manner. For example this dog picture will always flip 180 degrees....
Read more >
Unexpected Image Rotation [?] : r/tasker - Reddit
Weirdly, the image that gets copied to the other folders (A33, A39, and A42) gets rotated 90 degrees counterclockwise. Always the same rotation....
Read more >
image rotation is on wrong direction - General Support
When I upload the image to image field - image gets rotation in wrong direction. ... Turning off client-size resize option in the...
Read more >
Unintended image rotation - DokuWiki User Forum
If my image files are wider than they are tall, they are shown just fine. If they are taller than they are wide,...
Read more >
Unexpected figure rotation - TeX - LaTeX Stack Exchange
1 Answer 1 · Thank for your reply. In my case, i don't want unexpected Rotation when Height of image (2.5cm) > Width...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found