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

Fix rotate clockwise angle #1100

Closed
wants to merge 2 commits into from
Closed

Fix rotate clockwise angle #1100

wants to merge 2 commits into from

Conversation

MrLibya
Copy link

@MrLibya MrLibya commented Oct 9, 2022

What's Changing and Why

In the document it says that image rotate is clockwise and it should be!
But the fact is the rotate method is anti-clockwise, So this is fix for the bug & update tests for both clockwise & anti-clock rotate.

for e.g

// This is should rotate the image 90deg clockwise ( to the right ),
// But the fact its being rotated anti-clockwise ( to the left )
image.rotate(90) 

The bug caused by the rotation equation, The one is being used is anti-clockwise !
https://en.wikipedia.org/wiki/Rotation_matrix#In_two_dimensions

( Counter-Clockwise )
(Clockwise )

What else might be affected

Nothing but for sure everyone notice this error and made workaround like use negative rotate angle to get clockwise rotate

// Before fix - workaround to rotate image 90 to the right
image.rotate(-90) 

So when this fix is applied it should be

// After fix to rotate image 90 to the right
image.rotate(90) 

Tasks

  • Add tests
  • Add SemVer Label ( I couldn't tell if this will be major or minor !, Because it will affect a lot of people who was doing the workaround ! )
📦 Published PR as canary version: 0.16.3-canary.1100.1371.0

✨ Test out this PR locally via:

npm install @jimp/cli@0.16.3-canary.1100.1371.0
npm install @jimp/core@0.16.3-canary.1100.1371.0
npm install @jimp/custom@0.16.3-canary.1100.1371.0
npm install jimp@0.16.3-canary.1100.1371.0
npm install @jimp/plugin-blit@0.16.3-canary.1100.1371.0
npm install @jimp/plugin-blur@0.16.3-canary.1100.1371.0
npm install @jimp/plugin-circle@0.16.3-canary.1100.1371.0
npm install @jimp/plugin-color@0.16.3-canary.1100.1371.0
npm install @jimp/plugin-contain@0.16.3-canary.1100.1371.0
npm install @jimp/plugin-cover@0.16.3-canary.1100.1371.0
npm install @jimp/plugin-crop@0.16.3-canary.1100.1371.0
npm install @jimp/plugin-displace@0.16.3-canary.1100.1371.0
npm install @jimp/plugin-dither@0.16.3-canary.1100.1371.0
npm install @jimp/plugin-fisheye@0.16.3-canary.1100.1371.0
npm install @jimp/plugin-flip@0.16.3-canary.1100.1371.0
npm install @jimp/plugin-gaussian@0.16.3-canary.1100.1371.0
npm install @jimp/plugin-invert@0.16.3-canary.1100.1371.0
npm install @jimp/plugin-mask@0.16.3-canary.1100.1371.0
npm install @jimp/plugin-normalize@0.16.3-canary.1100.1371.0
npm install @jimp/plugin-print@0.16.3-canary.1100.1371.0
npm install @jimp/plugin-resize@0.16.3-canary.1100.1371.0
npm install @jimp/plugin-rotate@0.16.3-canary.1100.1371.0
npm install @jimp/plugin-scale@0.16.3-canary.1100.1371.0
npm install @jimp/plugin-shadow@0.16.3-canary.1100.1371.0
npm install @jimp/plugin-threshold@0.16.3-canary.1100.1371.0
npm install @jimp/plugins@0.16.3-canary.1100.1371.0
npm install @jimp/test-utils@0.16.3-canary.1100.1371.0
npm install @jimp/bmp@0.16.3-canary.1100.1371.0
npm install @jimp/gif@0.16.3-canary.1100.1371.0
npm install @jimp/jpeg@0.16.3-canary.1100.1371.0
npm install @jimp/png@0.16.3-canary.1100.1371.0
npm install @jimp/tiff@0.16.3-canary.1100.1371.0
npm install @jimp/types@0.16.3-canary.1100.1371.0
npm install @jimp/utils@0.16.3-canary.1100.1371.0
# or 
yarn add @jimp/cli@0.16.3-canary.1100.1371.0
yarn add @jimp/core@0.16.3-canary.1100.1371.0
yarn add @jimp/custom@0.16.3-canary.1100.1371.0
yarn add jimp@0.16.3-canary.1100.1371.0
yarn add @jimp/plugin-blit@0.16.3-canary.1100.1371.0
yarn add @jimp/plugin-blur@0.16.3-canary.1100.1371.0
yarn add @jimp/plugin-circle@0.16.3-canary.1100.1371.0
yarn add @jimp/plugin-color@0.16.3-canary.1100.1371.0
yarn add @jimp/plugin-contain@0.16.3-canary.1100.1371.0
yarn add @jimp/plugin-cover@0.16.3-canary.1100.1371.0
yarn add @jimp/plugin-crop@0.16.3-canary.1100.1371.0
yarn add @jimp/plugin-displace@0.16.3-canary.1100.1371.0
yarn add @jimp/plugin-dither@0.16.3-canary.1100.1371.0
yarn add @jimp/plugin-fisheye@0.16.3-canary.1100.1371.0
yarn add @jimp/plugin-flip@0.16.3-canary.1100.1371.0
yarn add @jimp/plugin-gaussian@0.16.3-canary.1100.1371.0
yarn add @jimp/plugin-invert@0.16.3-canary.1100.1371.0
yarn add @jimp/plugin-mask@0.16.3-canary.1100.1371.0
yarn add @jimp/plugin-normalize@0.16.3-canary.1100.1371.0
yarn add @jimp/plugin-print@0.16.3-canary.1100.1371.0
yarn add @jimp/plugin-resize@0.16.3-canary.1100.1371.0
yarn add @jimp/plugin-rotate@0.16.3-canary.1100.1371.0
yarn add @jimp/plugin-scale@0.16.3-canary.1100.1371.0
yarn add @jimp/plugin-shadow@0.16.3-canary.1100.1371.0
yarn add @jimp/plugin-threshold@0.16.3-canary.1100.1371.0
yarn add @jimp/plugins@0.16.3-canary.1100.1371.0
yarn add @jimp/test-utils@0.16.3-canary.1100.1371.0
yarn add @jimp/bmp@0.16.3-canary.1100.1371.0
yarn add @jimp/gif@0.16.3-canary.1100.1371.0
yarn add @jimp/jpeg@0.16.3-canary.1100.1371.0
yarn add @jimp/png@0.16.3-canary.1100.1371.0
yarn add @jimp/tiff@0.16.3-canary.1100.1371.0
yarn add @jimp/types@0.16.3-canary.1100.1371.0
yarn add @jimp/utils@0.16.3-canary.1100.1371.0

@MrLibya
Copy link
Author

MrLibya commented Oct 13, 2022

@oliver-moran @hipstersmoothie can you check that ?

@hipstersmoothie
Copy link
Collaborator

I think we should just update the docs since this would require a breaking change

@hipstersmoothie
Copy link
Collaborator

Closing in favor #1062. Thanks for trying though! If you want to help with more issue I'm gonna be more on top of issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants