Repository navigation
Description
Preflight Checklist
- I have read the Contributing Guidelines for this project.
- I agree to follow the Code of Conduct that this project adheres to.
- I have searched the issue tracker for a bug report that matches the one I want to file, without success.
Electron Version
37.0.0
What operating system(s) are you using?
macOS
Operating System Version
macOS 15.4.1
What arch are you using?
arm64 (including Apple Silicon)
Last Known Working Electron version
No response
Expected Behavior
The pixel value should have no difference.
Actual Behavior
The pixel value have significant difference.
Testcase Gist URL
Additional Information
When I'm writing test spec for shared texture, I find out that two visually identical nativeImages, which pixel may have difference in 1-2 per color (#20B14B vs #22B14C)
When called toBitmap, the buffer contains pixel difference way more larger than it should be.
Pixel (127, 120): img1: [88, 175, 85], img2: [76, 177, 34]
Pixel (127, 121): img1: [88, 175, 85], img2: [76, 177, 34]
Pixel (127, 122): img1: [88, 175, 85], img2: [76, 177, 34]
Pixel (127, 123): img1: [88, 175, 85], img2: [76, 177, 34]
Pixel (127, 124): img1: [88, 175, 85], img2: [76, 177, 34]
Pixel (127, 125): img1: [88, 175, 85], img2: [76, 177, 34]
Pixel (127, 126): img1: [88, 175, 85], img2: [76, 177, 34]
Pixel (127, 127): img1: [88, 175, 85], img2: [76, 177, 34]
You can reproduce it by nativeImage.createFromBuffer of these two pictures, and toBitmap, then compare the pixel values.
I think toBitmap or some new method should convert to a unified color space / color matrix to allow pixel compare, otherwise we have no way to compare pixel data.
It is also fun that when Qt rendering this image, it also reads the wrong color. So I suspect it also drops some color space info. However these two images are visually identical when rendered on web browsers.
Note that Windows doesn't have such error.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fields👍 Does Not Block Stable


Activity
[-]nativeImage.toBitmap() doesn't preserve color matrix / color space information.[/-][+]1nativeImage.toBitmap()1 doesn't preserve color matrix / color space information.[/+][-]1nativeImage.toBitmap()1 doesn't preserve color matrix / color space information.[/-][+]`nativeImage.toBitmap()` doesn't preserve color matrix / color space information.[/+]reitowo commentedon May 6, 2025
However, as the doc says it is the "native buffer" so I think it might be "technically correct" because color space info doesn't belongs to this buffer 😄 . But then this API is useless if color space is different, and there's no way to compare pixels, we don't even know two
nativeImagehave different color space.electron-issue-triage commentedon May 6, 2025
Hello @reitowo. Thanks for reporting this and helping to make Electron better!
Would it be possible for you to make a standalone testcase with only the code necessary to reproduce the issue? For example, Electron Fiddle is a great tool for making small test cases and makes it easy to publish your test case to a gist that Electron maintainers can use.
Stand-alone test cases make fixing issues go more smoothly: it ensure everyone's looking at the same issue, it removes all unnecessary variables from the equation, and it can also provide the basis for automated regression tests.
Now adding the blocked/need-reproNeeds a test case to reproduce the bug
label for this reason. After you make a test case, please link to it in a followup comment. This issue will be closed in 10 days if the above is not addressed.
reitowo commentedon May 7, 2025
https://gist.github.com/dd7a08a4652da5af679add73d4a92c02
5 remaining items
electron-issue-triage commentedon Nov 26, 2025
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!
reitowo commentedon Nov 26, 2025
bump
fix: normalize color space for consistent pixel values in nativeImage
electron-issue-triage commentedon Feb 25, 2026
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!
reitowo commentedon Feb 25, 2026
Bump
fix: normalize color space for consistent pixel values in nativeImage
fix: normalize color space for consistent pixel values in nativeImage
fix: normalize color space for consistent pixel values in nativeImage (…
fix: normalize color space for consistent pixel values in nativeImage (…