0
$\begingroup$

When I save an image in Mathematica 12.3 on Windows and then display it in a navigator, the colors look different. For example:

g = Graphics[{{Red, Disk[{0, 0}]}, {Blue, Disk[{1, 1}]}}]
Export["foo.png", g]

The red and blue in the notebook are saturated (255,0,0) and (0,0,255). However, when displayed in a browser or the built-in Windows image viewer, the image file looks like this:

enter image description here

The red and blue are washed out compared to the colors I see in the notebook. However, if I open the image file in an image editor like GIMP or Paint, I see the original colors.

I'd like my image file to have the same colors when displayed in the browser as the original image in the notebook. I've played around with ColorSpace and ColorConvert to no avail. Does anyone know how to achieve this?

Thanks a lot!

Edit: The 'washed-out' effect in the browser seems to be independent of Mathematica and its image export. For example, if I draw HTML elements with the color #ff0000, they are the same washed-out red as the red disk in the above image. I suspect that this has something to do with the sRGB color space. Nevertheless, my problem remains: I'd like to export images that display in the exact same way in a browser as they do in a Mathematica notebook. Is it possible to convert colors so that the resulting exported colors display the same in the browser as in a Mathematica notebook? Or, worse come to worst, can I set the Mathematica front end to display colors like a browser?

$\endgroup$
1
  • 1
    $\begingroup$ This doesn't seem to be a MMA problem though. If you have the right colors in GIMP or Paint, then MMA generated the right image. It's your viewers that are doing it justice, isn't it? $\endgroup$
    – MarcoB
    Commented Nov 2, 2022 at 14:39

1 Answer 1

1
$\begingroup$

This has to do with browsers, not Mathematica. On Windows, Chrome and Edge display colors using the ICC profile. On my machine, for example, this results in saturated red (255,0,0) being displayed as the 'washed-out' (217,49,34). However, both the Mathematica (12.3) front end and Firefox do not use the ICC profile and just display raw colors, resulting in saturated red being displayed as (255,0,0).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.