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

Threshold and trim doesn't work after rotation #2087

Closed
jpbecotte opened this issue Feb 19, 2020 · 2 comments
Closed

Threshold and trim doesn't work after rotation #2087

jpbecotte opened this issue Feb 19, 2020 · 2 comments

Comments

@jpbecotte
Copy link

jpbecotte commented Feb 19, 2020

What is the output of running npx envinfo --binaries --languages --system --utilities?
System:
OS: macOS 10.15.1
CPU: (4) x64 Intel(R) Core(TM) i5-5250U CPU @ 1.60GHz
Memory: 153.41 MB / 8.00 GB
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 12.10.0 - /usr/local/bin/node
Yarn: 1.17.3 - /usr/local/bin/yarn
npm: 6.11.3 - /usr/local/bin/npm
Utilities:
Make: 3.81 - /usr/bin/make
GCC: 4.2.1 - /usr/bin/gcc
Git: 2.21.0 - /usr/bin/git
Clang: 1100.0.33.12 - /usr/bin/clang
Subversion: 1.10.4 - /usr/bin/svn
Languages:
Bash: 3.2.57 - /bin/bash
Elixir: 1.9.4 - /usr/local/bin/elixir
Java: 1.8.0_202 - /usr/bin/javac
Perl: 5.18.4 - /usr/bin/perl
PHP: 7.3.7 - /usr/local/bin/php
Python: 2.7.16 - /usr/bin/python
Python3: 3.7.6 - /usr/local/bin/python3
Ruby: 2.6.3 - /usr/bin/ruby

What are the steps to reproduce?
Use the following script:

const sharp = require('sharp');

const imageStr = ',/9j/4AAQSkZJRgABAQAASABIAAD/4QBMRXhpZgAATU0AKgAAAAgAAgESAAMAAAABAAEAAIdpAAQAAAABAAAAJgAAAAAAAqACAAQAAAABAAABQ6ADAAQAAAABAAABaAAAAAD/7QA4UGhvdG9zaG9wIDMuMAA4QklNBAQAAAAAAAA4QklNBCUAAAAAABDUHYzZjwCyBOmACZjs+EJ+/+IReElDQ19QUk9GSUxFAAEBAAARaGFwcGwCAAAAb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F52qNzFmOWYk+d0UUUUUUUUUUUUUUUUUV//9P+f+iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiv/2Q==';

async function process() {
  /* these steps are mandatory before finding the right angle */
  let image = await sharp(new Buffer(imageStr, 'base64'))
    .threshold()
    .trim(127);

  /* here I need to call a function that returns the right angle to deskew the image */
  const angle = -30;

  await image
    .rotate(angle)
    .threshold()
    .trim(127)
    .toFile('/tmp/image.jpg');
}

process()
  .then(() => console.log('ok'))
  .catch((err) => console.log(err))

What is the expected behaviour?
The functions threshold and trim should work as expected and all the black in top and bottom should be removed in the saved image.

Are you able to provide a standalone code sample, without other dependencies, that demonstrates this problem?
See above

Are you able to provide a sample image that helps explain the problem?
Look in the code!

@lovell
Copy link
Owner

lovell commented Feb 23, 2020

Hi, thanks for reporting, commit e9b21f2 adds a test and the fix. This will be in v0.25.0.

@lovell lovell added this to the v0.25.0 milestone Mar 9, 2020
@lovell
Copy link
Owner

lovell commented Mar 9, 2020

This is now available.

@lovell lovell closed this as completed Mar 9, 2020
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