Skip to content

Add keep_rgb option when saving JPEG to prevent conversion of RGB colorspace#7553

Merged
radarhere merged 6 commits intopython-pillow:mainfrom
bgilbert:jpeg-rgb
Jan 1, 2024
Merged

Add keep_rgb option when saving JPEG to prevent conversion of RGB colorspace#7553
radarhere merged 6 commits intopython-pillow:mainfrom
bgilbert:jpeg-rgb

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
@bgilbert
Copy link
Contributor Author

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

@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>
@radarhere radarhere merged commit d93a5ad into python-pillow:main Jan 1, 2024
@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

7 participants