jimp icon indicating copy to clipboard operation
jimp copied to clipboard

Fix rotate clockwise angle

Open MrLibya opened this issue 1 year ago • 1 comments

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

  • [x] 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

:sparkles: Test out this PR locally via:

npm install @jimp/[email protected]
npm install @jimp/[email protected]
npm install @jimp/[email protected]
npm install [email protected]
npm install @jimp/[email protected]
npm install @jimp/[email protected]
npm install @jimp/[email protected]
npm install @jimp/[email protected]
npm install @jimp/[email protected]
npm install @jimp/[email protected]
npm install @jimp/[email protected]
npm install @jimp/[email protected]
npm install @jimp/[email protected]
npm install @jimp/[email protected]
npm install @jimp/[email protected]
npm install @jimp/[email protected]
npm install @jimp/[email protected]
npm install @jimp/[email protected]
npm install @jimp/[email protected]
npm install @jimp/[email protected]
npm install @jimp/[email protected]
npm install @jimp/[email protected]
npm install @jimp/[email protected]
npm install @jimp/[email protected]
npm install @jimp/[email protected]
npm install @jimp/[email protected]
npm install @jimp/[email protected]
npm install @jimp/[email protected]
npm install @jimp/[email protected]
npm install @jimp/[email protected]
npm install @jimp/[email protected]
npm install @jimp/[email protected]
npm install @jimp/[email protected]
npm install @jimp/[email protected]
# or 
yarn add @jimp/[email protected]
yarn add @jimp/[email protected]
yarn add @jimp/[email protected]
yarn add [email protected]
yarn add @jimp/[email protected]
yarn add @jimp/[email protected]
yarn add @jimp/[email protected]
yarn add @jimp/[email protected]
yarn add @jimp/[email protected]
yarn add @jimp/[email protected]
yarn add @jimp/[email protected]
yarn add @jimp/[email protected]
yarn add @jimp/[email protected]
yarn add @jimp/[email protected]
yarn add @jimp/[email protected]
yarn add @jimp/[email protected]
yarn add @jimp/[email protected]
yarn add @jimp/[email protected]
yarn add @jimp/[email protected]
yarn add @jimp/[email protected]
yarn add @jimp/[email protected]
yarn add @jimp/[email protected]
yarn add @jimp/[email protected]
yarn add @jimp/[email protected]
yarn add @jimp/[email protected]
yarn add @jimp/[email protected]
yarn add @jimp/[email protected]
yarn add @jimp/[email protected]
yarn add @jimp/[email protected]
yarn add @jimp/[email protected]
yarn add @jimp/[email protected]
yarn add @jimp/[email protected]
yarn add @jimp/[email protected]
yarn add @jimp/[email protected]

MrLibya avatar Oct 09 '22 20:10 MrLibya

@oliver-moran @hipstersmoothie can you check that ?

MrLibya avatar Oct 13 '22 19:10 MrLibya