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 Mar 22, 2021
Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
@elejke elejke requested a review from radarhere Mar 22, 2021
Tests/test_imageops.py Outdated Show resolved Hide resolved
src/PIL/ImageOps.py Show resolved Hide resolved
docs/releasenotes/8.2.0.rst Outdated Show resolved Hide resolved
Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
@elejke elejke requested a review from hugovk Mar 23, 2021
Tests/test_imageops.py Outdated Show resolved Hide resolved
Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
hugovk
hugovk approved these changes Mar 27, 2021
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 Mar 29, 2021
docs/releasenotes/8.2.0.rst Outdated Show resolved Hide resolved
elejke and others added 2 commits Mar 29, 2021
Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
@radarhere
Copy link
Member

@radarhere radarhere commented Mar 29, 2021

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 elejke commented Mar 29, 2021

Good idea, thank you @radarhere

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

Successfully merging this pull request may close these issues.

None yet

3 participants