-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Resize and Composite happen out of order #1790
Comments
This also happens when using |
Hi, you'll need to break this into two pipelines, something like: const composited = await sharp({create: {height: 100, width: 100, channels: 3, background: 'red'}})
.composite([{input: {create: {width: 10, height: 10, channels: 3, background: 'green'}}, gravity: "southwest"}])
.png();
.toBuffer();
sharp(composited)
.resize({width: 300, height: 300})
.toFile("out.png"); |
This seems like either an implementation bug or an API bug to me, rather than a question. When a fluent API is offered, surely it is reasonable to expect that inherently-ordered operations expressed with it are actually processed in the specified order? I can understand that it might be necessary on a technical level to break it into two pipelines, but isn't that something that the library should be doing internally as-needed? This way it seems like a leaky abstraction to me, where you need to know exactly how something is internally processed to know where it is valid to use a particular operation. |
What is the output of running
npx envinfo --binaries --languages --system --utilities
?What are the steps to reproduce?
Having a resize operation after a composite, will result in the composite happening on the resized image.
What is the expected behaviour?
The composite should happen first, because it's earlier in the line. After that, the image should get the resize
Are you able to provide a standalone code sample, without other dependencies, that demonstrates this problem?
The green square will still be 10x10 pixels, instead of being resized with the original image.
The text was updated successfully, but these errors were encountered: