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

Add preserve_tone option to autocontrast #5350

Merged
merged 16 commits into from Mar 29, 2021
Merged

Conversation

elejke
Copy link
Contributor

@elejke elejke commented Mar 21, 2021

Changes proposed in this pull request:

  • Added preserve_tone option to the autocontrast function.

As already have been discussed here autocontrast function changes the tone of the image because of the usage of separate histograms for each channel.

@broxeph, @wiredfool

Example:
example

Tests/test_imageops.py Outdated Show resolved Hide resolved
Tests/test_imageops.py Outdated Show resolved Hide resolved
Tests/test_imageops.py Outdated Show resolved Hide resolved
elejke and others added 2 commits March 22, 2021 15:27
Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
@elejke elejke requested a review from radarhere March 22, 2021 14:25
Tests/test_imageops.py Outdated Show resolved Hide resolved
Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
@elejke elejke requested a review from hugovk March 23, 2021 18:21
Tests/test_imageops.py Outdated Show resolved Hide resolved
Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
Tests/test_imageops.py Outdated Show resolved Hide resolved
Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
@elejke elejke requested a review from radarhere March 29, 2021 09:40
elejke and others added 2 commits March 29, 2021 14:12
Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
@radarhere
Copy link
Member

If I remove the change to preserve tone, the tests still pass. I understand that these tests came from #1246 (comment), but they aren't going to prevent us accidentally undoing this change in the future.

I've created elejke#2 to add a test to guard against regression, by checking that preserve_tone affects RGB images, but not L images.

@elejke
Copy link
Contributor Author

elejke commented Mar 29, 2021

Good idea, thank you @radarhere

@radarhere radarhere merged commit b0b4fee into python-pillow:master Mar 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants