Conversation
…#48178) * fix: normalize color space for consistent pixel values in nativeImage toBitmap() now normalizes the color space to sRGB by default, ensuring that visually identical images produce consistent pixel values regardless of their original color profile (e.g., Display P3 on macOS). An optional colorSpace parameter is added to toBitmap() to control the target color space: 'srgb' (default), 'display-p3', or 'source' (no conversion). Closes #46949 * fix: implement feedback * fix: correct include ordering in electron_api_native_image.cc Sort ui/gfx/ includes alphabetically: codec/jpeg_codec.h, codec/png_codec.h, then color_space.h. * docs: add breaking-changes entry and update getBitmap docs - Add breaking-changes.md entry for toBitmap() color space normalization under Planned Breaking API Changes (41.0) - Update getBitmap() docs to include colorSpace option and breaking-changes-header since it delegates to toBitmap() * docs: linter: remove semicolons from js code samples * docs: linter: make change description <= 120 chars * test: fix new colorSpace spec * test: regenerate nativeImage color-space PNG fixtures Regenerate the colorspace-srgb.png and colorspace-p3.png test fixtures so they represent the same visual color encoded in two different source color spaces. The updated sRGB fixture stores the color as sRGB pixel values, while the Display P3 fixture stores the corresponding Display P3 pixel values and retains its embedded P3 ICC profile. Even though the source bitmaps can contain different bytes, their outputs should be byte-identical after normalization to the sRGB color space. * docs: marked breaking change for 43.0 * chore: fix up for lint --------- Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> Co-authored-by: Felix Rieseberg <f@anthropic.com>
5 tasks
ckerr
approved these changes
May 8, 2026
|
Release Notes Persisted
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport of #48178
See that PR for details.
Notes: fix: If a
nativeImagewas passed an image with a color profile, its pixel values will now be normalized to SRGB. This ensures that two visually identical images after color space application will receive similar pixel values when converted to anativeImage.