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

Trimming b-w images do not work after upgrade to 0.31.0 #3386

Closed
3 tasks done
marcincichocki opened this issue Sep 25, 2022 · 2 comments
Closed
3 tasks done

Trimming b-w images do not work after upgrade to 0.31.0 #3386

marcincichocki opened this issue Sep 25, 2022 · 2 comments

Comments

@marcincichocki
Copy link

Possible bug

Is this a possible bug in a feature of sharp, unrelated to installation?

  • Running npm install sharp completes without error.
  • Running 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?

  • I am using the latest version of sharp as reported by npm 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?

  System:
    OS: Linux 4.19 Ubuntu 20.04 LTS (Focal Fossa)
    CPU: (6) x64 Intel(R) Core(TM) i5-8600K CPU @ 3.60GHz
    Memory: 10.27 GB / 12.45 GB
    Container: Yes
    Shell: 5.8 - /usr/bin/zsh
  Binaries:
    Node: 14.17.1 - ~/.nvm/versions/node/v14.17.1/bin/node
    npm: 7.18.1 - ~/.nvm/versions/node/v14.17.1/bin/npm
  npmPackages:
    sharp: ^0.31.0 => 0.31.0

What are the steps to reproduce?

Run code sample in node.js against provided image. It is correctly trimmed in 0.30.7, but not in 0.31.0. Interestingly, when trimming
sharp(await instance.toBuffer()) trimming works as expected.

What is the expected behaviour?

Test image should be trimmed just like on 0.30.7

Please provide a minimal, standalone code sample, without other dependencies, that demonstrates this problem

const sharp = require('sharp');

(async () => {
  const instance = sharp('./test.png');
  const meta = await instance.metadata();

  console.log(meta);

  const { data, info } = await instance
    .trim()
    .toBuffer({ resolveWithObject: true });

  console.log(info); // trimOffsetLeft is 0
  console.log(data.toString('base64'));
})();

Please provide sample image(s) that help explain this problem

test2

@lovell
Copy link
Owner

lovell commented Sep 26, 2022

Commit d1004ee fixes this and adds a test that would previously have failed. This will be in v0.31.1, thank you for reporting.

@lovell
Copy link
Owner

lovell commented Sep 29, 2022

v0.31.1 now available

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