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

Added .linear(a, b) operation for levels adjustment #742

Closed

Conversation

brandonreavis
Copy link

This just exposes the libvips' linear method which is useful when you need to do a manual levels adjustment and not use the more automatic normalize method.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.5%) to 98.901% when pulling c9fdf5e on naturalatlas:linear-levels-adjustment into 9707f8c on lovell:master.

Copy link
Owner

@lovell lovell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Brandon, thank you for this well-written PR. I've made a couple of minor comments inline.

* @throws {Error} Invalid parameters
*/
const linear = function linear (a, b) {
if (!is.defined(linear)) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean to check a and/or b here?

this.options.linearA = a;
this.options.linearB = b;
} else {
throw new Error('Invalid linear arguments ' + a + ',' + b);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ES6 template literals are "allowed" if you'd like to use them here :)

const fixtures = require('../fixtures');

describe('Linear adjustment', function () {
it('applies levels adjustment', function (done) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you able to add a test for the code path that removes/rejoins the alpha channel?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, and a test for the throwing of "Invalid linear arguments" please.

@lovell
Copy link
Owner

lovell commented Mar 25, 2017

Feel free to add yourself to the contributors list also!

@lovell
Copy link
Owner

lovell commented Nov 14, 2017

This PR has formed the basis of another PR - see #1024

@lovell
Copy link
Owner

lovell commented Nov 15, 2017

Superseded by #1024 - thank you for taking the time to submit this PR - I expect this feature to ship in v0.19.0.

@lovell lovell closed this Nov 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants