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

Make contrast behave more like CSS/Photoshop legacy constrast #658

Merged
merged 2 commits into from
Nov 28, 2018

Conversation

nrkn
Copy link
Contributor

@nrkn nrkn commented Nov 13, 2018

What's Changing and Why

The contrast function in the color package was modified to behave more like the CSS contrast filter or Photoshop's legacy contrast mode (eg negative values move towards mid gray, positive values push colors near mid to their dark/light extremes)

What else might be affected

Nothing else in Jimp uses the contrast function, so theoretically, nothing.

Tasks

  • Add tests

It appears that there are not currently any tests for contrast.

Was going to add some, but could not get Jimp to clean/build/run tests etc on Windows after cloning and doing NPM install - someone may want to look into cross platform testing, whether all build/clean/test dependencies are correctly installed etc. - I did notice some *nix shell specific things like rf in there

However I have manually verified by eye that an image adjusted with this algorithm from -1 to 1 by increments of 0.1 looks correct compared to both Photoshop and CSS

Somebody on whose system Jimp does correctly build should do a sanity check before merging this branch though, just to be sure that I haven't broken anything, unlikely though it seems.

  • Update Documentation

contrast does not change from the user's point of view, no changes to documentation needed

  • Update jimp.d.ts

All changes are internal to the contrast function, not required

@hipstersmoothie hipstersmoothie added the enhancement a request for a new feature or change in behavior label Nov 23, 2018
Copy link
Collaborator

@hipstersmoothie hipstersmoothie left a comment

Choose a reason for hiding this comment

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

Sorry for taking so long to get to this! I do not have a windows machine so I'll do my best to get it building on windows

packages/plugin-color/src/index.js Outdated Show resolved Hide resolved
@hipstersmoothie hipstersmoothie merged commit 7f62956 into jimp-dev:master Nov 28, 2018
hipstersmoothie pushed a commit that referenced this pull request Nov 28, 2018
* Make contrast behave more like CSS/Photoshop legacy constrast

* Update index.js
@nrkn nrkn deleted the contrast branch November 28, 2018 22:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement a request for a new feature or change in behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants