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

Rotation angles that are not multiples of 90 ignore operation ordering #1682

Closed
iovdin opened this issue Apr 30, 2019 · 2 comments
Closed

Rotation angles that are not multiples of 90 ignore operation ordering #1682

iovdin opened this issue Apr 30, 2019 · 2 comments

Comments

@iovdin
Copy link
Contributor

iovdin commented Apr 30, 2019

521   System:
522     OS: macOS High Sierra 10.13.6
523     CPU: (4) x64 Intel(R) Core(TM) i5-3230M CPU @ 2.60GHz
524     Memory: 82.42 MB / 8.00 GB
525     Shell: 3.2.57 - /bin/bash
526   Binaries:
527     Node: 10.9.0 - ~/.nvm/versions/node/v10.9.0/bin/node
528     Yarn: 1.12.3 - ~/.yarn/bin/yarn
529     npm: 6.2.0 - ~/.nvm/versions/node/v10.9.0/bin/npm
530     Watchman: 4.9.0 - /usr/local/bin/watchman
531   Utilities:
532     CMake: 3.8.2 - /usr/local/bin/cmake
533     Make: 3.81 - /usr/bin/make
534     GCC: 4.2.1 - /usr/bin/gcc
535     Git: 2.13.2 - /usr/local/bin/git
536   Languages:
537     Bash: 3.2.57 - /bin/bash
538     Go: 1.8.3 - /usr/local/bin/go
539     Java: 1.8.0_77 - /usr/bin/javac
540     Perl: 5.18.2 - /usr/bin/perl
541     PHP: 7.1.23 - /usr/bin/php
542     Python: 2.7.12 - /Users/iovdin/projects/miniconda2/bin/python
543     Ruby: 2.3.7p456 - /usr/bin/ruby
544     Rust: 1.28.0 - /usr/local/bin/rustc

running this code

const fs = require('fs');
const sharp = require('sharp');
const https = require('https');

const picUrl = "https://www.cosy.sbg.ac.at/~pmeerw/Watermarking/lena_color.gif"

const pipeline = sharp()
  .rotate(45)
  .extract({ left: 100, top: 100, width: 312, height: 312 })

https.get(picUrl, (res) => {
  res.pipe(pipeline);
  pipeline.pipe(fs.createWriteStream('out.jpg'))
})

Both rotate, extract and extract, rotate order gives the same result image

What is the expected behaviour?
After the rotation, I'd expect extract work with rotated image

@lovell
Copy link
Owner

lovell commented May 2, 2019

Hi, it looks like angles at multiples of 90 work as you would expect but sadly not other angles, support for which was introduced in #1385.

(Note to self/fixer: the rotation angle logic in JS should be simplified/refactored to remove the distinction between 90 and non-90 angles, moving the vips_rot vs vips_rotate decision into a separate internal C++ operation function.)

@lovell lovell added the bug label May 2, 2019
@lovell lovell changed the title rotate extract order does not matter Rotation angles that are not multiples of 90 ignore operation ordering May 2, 2019
@lovell lovell added this to the v0.23.0 milestone Jul 26, 2019
@lovell
Copy link
Owner

lovell commented Jul 29, 2019

sharp v0.23.0 / libvips v8.8.1 is now available. Thank you for the PR to fix this!

@lovell lovell closed this as completed Jul 29, 2019
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

2 participants