Possible bug
Is this a possible bug in a feature of sharp, unrelated to installation?
Are you using the latest version of sharp?
What is the output of running npx envinfo --binaries --system --npmPackages=sharp --npmGlobalPackages=sharp?
System:
OS: Linux 5.16 Arch Linux
CPU: (8) x64 Intel(R) Core(TM) i5-8265U CPU @ 1.60GHz
Memory: 10.56 GB / 23.20 GB
Container: Yes
Shell: 5.8.1 - /usr/bin/zsh
Binaries:
Node: 16.9.1 - ~/.nvm/versions/node/v16.9.1/bin/node
Yarn: 1.22.17 - /usr/bin/yarn
npm: 7.21.1 - ~/.nvm/versions/node/v16.9.1/bin/npm
What are the steps to reproduce?
sharp({
create: {
width: 2,
height: 2,
channels: 3,
background: { r: 10, g: 20, b: 30 }
}
})
.negate()
.negate()
.toBuffer(function(err, data, info) {
console.log('data', data);
});
What is the expected behaviour?
Expected output: data <Buffer 0a 14 1e 0a 14 1e 0a 14 1e 0a 14 1e>
Actual output: data <Buffer 00 00 00 00 00 00 00 00 00 00 00 00>
Additional information
Unit tests cover the case of loading PNG and JPEG which run correctly. But constructing the image manually via create {} turns all bytes into 00.
Calling negate should negate the image, but 00 is instead set to all bytes. When negate(true) is called, 00 is set to all bytes expect for the alpha channel, which is kept untouched.
Possible bug
Is this a possible bug in a feature of sharp, unrelated to installation?
npm install sharpcompletes without error.node -e "require('sharp')"completes without error.Are you using the latest version of sharp?
sharpas reported bynpm view sharp dist-tags.latest.What is the output of running
npx envinfo --binaries --system --npmPackages=sharp --npmGlobalPackages=sharp?What are the steps to reproduce?
What is the expected behaviour?
Expected output:
data <Buffer 0a 14 1e 0a 14 1e 0a 14 1e 0a 14 1e>Actual output:
data <Buffer 00 00 00 00 00 00 00 00 00 00 00 00>Additional information
Unit tests cover the case of loading PNG and JPEG which run correctly. But constructing the image manually via
create {}turns all bytes into00.Calling
negateshould negate the image, but00is instead set to all bytes. Whennegate(true)is called,00is set to all bytes expect for the alpha channel, which is kept untouched.