Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sharp v0.31.1 bug with rotation+resize #3391

Closed
3 tasks done
asilvas-godaddy opened this issue Sep 29, 2022 · 4 comments
Closed
3 tasks done

sharp v0.31.1 bug with rotation+resize #3391

asilvas-godaddy opened this issue Sep 29, 2022 · 4 comments

Comments

@asilvas-godaddy
Copy link

Possible bug

Is this a possible bug in a feature of sharp, unrelated to installation?

  • Running npm install sharp completes without error.
  • Running node -e "require('sharp')" completes without error.

If you cannot confirm both of these, please open an installation issue instead.

Are you using the latest version of sharp?

  • I am using the latest version of sharp as reported by npm view sharp dist-tags.latest.

What is the output of running npx envinfo --binaries --system --npmPackages=sharp --npmGlobalPackages=sharp?

System:
    OS: macOS 12.3.1
    CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
    Memory: 494.40 MB / 32.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.15.1 - ~/.nvm/versions/node/v16.15.1/bin/node
    npm: 8.11.0 - ~/.nvm/versions/node/v16.15.1/bin/npm
  npmPackages:
    sharp: ^0.31.1 => 0.31.1 

What are the steps to reproduce?

https://gist.github.com/asilvas-godaddy/2430fb186c51407ccb90b2900c7fd64a

What is the expected behaviour?

Resizing after rotation should not break rotation. This was caught in test suite from https://github.com/asilvas/node-image-steam

Please provide a minimal, standalone code sample, without other dependencies, that demonstrates this problem

https://gist.github.com/asilvas-godaddy/2430fb186c51407ccb90b2900c7fd64a

Please provide sample image(s) that help explain this problem

Source: https://drive.google.com/file/d/176GYzVQ_bj0X57CvZS5CfgiZzFjTAkMl/view?usp=sharing
The rotated output is correct after flip+90deg rotate. But if also resizing, the orientation breaks.

@asilvas-godaddy asilvas-godaddy changed the title sharp v0.31.1 bug with rotatiion+resize sharp v0.31.1 bug with rotation+resize Sep 29, 2022
@lovell
Copy link
Owner

lovell commented Sep 30, 2022

Hi Aaron, thanks for reporting, I can reproduce plus suspect I know what's causing it too (need to harmonise the ordering for flip and flip-due-to-auto-orient). Leave this with me - I'll add your scenario as a test case to prevent regression too.

@lovell
Copy link
Owner

lovell commented Oct 1, 2022

Commit eacb833 refactors some of the logic to ensure the flip/flop/rotate operation ordering is consistent, separating auto-orient vs manual orient, plus adds your two scenarios that would previously have failed as new test cases.

@lovell lovell added this to the v0.31.2 milestone Oct 1, 2022
@asilvas
Copy link

asilvas commented Oct 1, 2022

Thank you!

@lovell
Copy link
Owner

lovell commented Nov 4, 2022

sharp v0.31.2 now available, thanks for reporting.

@lovell lovell closed this as completed Nov 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants