Pipeline chain order not respected when rotate is used after resize with fit mode "inside" #3756
Closed
3 tasks done
Labels
Milestone
Possible bug
Is this a possible bug in a feature of sharp, unrelated to installation?
npm install sharp
completes without error.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?
sharp
as reported bynpm view sharp dist-tags.latest
.If you cannot confirm this, please upgrade to the latest version and try again before opening an issue.
If you are using another package which depends on a version of
sharp
that is not the latest, please open an issue against that package instead.What is the output of running
npx envinfo --binaries --system --npmPackages=sharp --npmGlobalPackages=sharp
?What are the steps to reproduce?
Creating an image manipulation pipeline which first resizes the image to a set width of 400 pixels and then rotates it by 90 degrees. The example code in the documentation works correctly, but in this scenario, the
fit
property of theresize
pipeline is set tofill
. However, in my use case, this property needs to be set toinside
.What is the expected behaviour?
rotate -> resize
should work consistently across bothfill
andinside
fit modes and output images that have a height of 400 pixels. With thefit: "inside"
property, the image does not have a height of 400 pixels after rotating it by 90 degrees. Instead, it retains the original image dimensions that were resulted by the resize operation. In other words, the order of the chained operations doesn't matter if the fit property is set to"inside"
.I am not entirely sure if this is a bug or intended behavior, however, I would have expected it to work sequentially in all cases. I work with streams so I would prefer to avoid having to create new sharp instances and work around my setup just to get around this.
Please provide a minimal, standalone code sample, without other dependencies, that demonstrates this problem
Minimal reproduction repo with unit tests to exemplify: https://github.com/jozsefsallai/sharp-resize-rotate-inside-repro
Relevant code:
Please provide sample image(s) that help explain this problem
The text was updated successfully, but these errors were encountered: