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 keep_rgb option when saving JPEG to prevent conversion of RGB colorspace #7553

Merged
merged 6 commits into from Jan 1, 2024

Conversation

bgilbert
Copy link
Contributor

@bgilbert bgilbert commented Nov 14, 2023

libjpeg automatically converts RGB to YCbCr by default. Add a keep_rgb option to disable libjpeg's automatic conversion of RGB images during write.

@radarhere radarhere added the JPEG label Nov 14, 2023
@radarhere radarhere changed the title Allow writing RGB JPEGs Added keep_colorspace option when saving JPEG to prevent conversion of RGB colorspace Nov 14, 2023
@bgilbert bgilbert marked this pull request as draft November 25, 2023 21:10
@bgilbert bgilbert changed the title Added keep_colorspace option when saving JPEG to prevent conversion of RGB colorspace Added keep_rgb option when saving JPEG to prevent conversion of RGB colorspace Nov 25, 2023
@bgilbert bgilbert changed the title Added keep_rgb option when saving JPEG to prevent conversion of RGB colorspace Add keep_rgb option when saving JPEG to prevent conversion of RGB colorspace Nov 25, 2023
@bgilbert bgilbert marked this pull request as ready for review November 25, 2023 21:34
@bgilbert
Copy link
Contributor Author

Rebased (first push) and switched to keep_rgb (second push).

radarhere
radarhere previously approved these changes Nov 27, 2023
Tests/test_file_jpeg.py Outdated Show resolved Hide resolved
@bgilbert
Copy link
Contributor Author

Added @radarhere's test improvements from bgilbert#3.

Tests/test_file_jpeg.py Outdated Show resolved Hide resolved
Tests/test_file_jpeg.py Outdated Show resolved Hide resolved
@radarhere radarhere dismissed their stale review December 4, 2023 12:54

Further discussion

bgilbert and others added 3 commits December 13, 2023 18:26
libjpeg automatically converts RGB to YCbCr by default.  Add a keep_rgb
option to disable libjpeg's automatic conversion of RGB images during
write.
-1 is the default; 3 is invalid and should behave the same as the default.
@bgilbert
Copy link
Contributor Author

Rebased onto current main and added release note.

@bgilbert
Copy link
Contributor Author

Is anything else needed here?

@bgilbert
Copy link
Contributor Author

Applied suggestions.

bgilbert and others added 2 commits December 26, 2023 12:37
The user presumably doesn't intend to subsample the green and blue
channels.
Co-authored-by: Andrew Murray <radarhere@users.noreply.github.com>
Tests/test_file_jpeg.py Show resolved Hide resolved
@radarhere radarhere merged commit d93a5ad into python-pillow:main Jan 1, 2024
59 checks passed
@bgilbert bgilbert deleted the jpeg-rgb branch January 1, 2024 18:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants