# Julia image display on Mac goes dark

**URL:** <https://discourse.julialang.org/t/julia-image-display-on-mac-goes-dark/127436>\
**Category:** Visualization\
**Created:** [March 28, 2025, 4:35am UTC](https://discourse.julialang.org/t/julia-image-display-on-mac-goes-dark/127436 "2025-03-28T04:35:50Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![rmfritz](https://avatars.discourse-cdn.com/v4/letter/r/b487fb/32.png) [@rmfritz](https://discourse.julialang.org/u/rmfritz)\
**Post date:** [March 28, 2025, 4:35am UTC](https://discourse.julialang.org/t/julia-image-display-on-mac-goes-dark/127436/1 "2025-03-28T04:35:50Z")

</div>

I’m working with some images in Julia, and I’m running into a problem; the images, when displayed from the Julia command line with ImageView, or within a Jupyter notebook, are much much darker than when they are displayed by the Mac image viewer, preview, or by the Chrome browser. Has anyone else observed this? Any ideas about what is going on?

---

<div class="post-metadata">

**Author:** ![digital\_carver](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/digital_carver/32/33818_2.png) [@digital\_carver](https://discourse.julialang.org/u/digital_carver)\
**Post date:** [March 28, 2025, 7:38am UTC](https://discourse.julialang.org/t/julia-image-display-on-mac-goes-dark/127436/2 "2025-03-28T07:38:08Z")

</div>

What type of images are they, and how are you loading them?

Also, what do you mean when you much much darker? Do all the colors appear as their darker variant, or is it some parts of the image that appear black or some dark colour? If it’s the former, then the issue is probably with the loading of the image, the data in it not being interpreted the right way.

It would also be useful if you’re able to share any of the images, along with how they look in Julia vs other image viewers.

---

<div class="post-metadata">

**Author:** ![rmfritz](https://avatars.discourse-cdn.com/v4/letter/r/b487fb/32.png) [@rmfritz](https://discourse.julialang.org/u/rmfritz)\
**Post date:** [March 28, 2025, 7:40pm UTC](https://discourse.julialang.org/t/julia-image-display-on-mac-goes-dark/127436/3 "2025-03-28T19:40:46Z")

</div>

Loading it with FileIO.load()

This is my test image; a very old image from a physically based rendering program. I’ve done some more experimentation and it’s absolutely eerie. There’s some sort of exposure compensation with the OS app and browser that works differently in the Julia image display software with this particular image. Here, right now, in the browser it looks fine. I’ve screenshotted the Jupyter display, and look how dark it is. And yet most of the time the Julia image load seems to work fine.

 ![out5](https://global.discourse-cdn.com/julialang/original/3X/b/2/b22acbfe247069ea37dbd7e832b1573c28293134.jpeg)

 ![image](https://global.discourse-cdn.com/julialang/original/3X/6/e/6ec774597c863b83ebba2acb31964e2b29d345a2.jpeg)

---

<div class="post-metadata">

**Author:** ![rmfritz](https://avatars.discourse-cdn.com/v4/letter/r/b487fb/32.png) [@rmfritz](https://discourse.julialang.org/u/rmfritz)\
**Post date:** [March 28, 2025, 8:16pm UTC](https://discourse.julialang.org/t/julia-image-display-on-mac-goes-dark/127436/4 "2025-03-28T20:16:53Z")

</div>

A little more testing reveals that, not very surprisingly, the pixel values come in correctly and that, yes, the dark areas of the image are quite dark. Is the OS/browser display software applying some sort of exposure correction (gamma? histogram?) which Julia does not apply?

---

<div class="post-metadata">

**Author:** ![goerz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/goerz/32/3269_2.png) [@goerz](https://discourse.julialang.org/u/goerz)\
**Post date:** [March 28, 2025, 8:55pm UTC](https://discourse.julialang.org/t/julia-image-display-on-mac-goes-dark/127436/5 "2025-03-28T20:55:57Z")

</div>

Have you tried different browsers?

---

<div class="post-metadata">

**Author:** ![rmfritz](https://avatars.discourse-cdn.com/v4/letter/r/b487fb/32.png) [@rmfritz](https://discourse.julialang.org/u/rmfritz)\
**Post date:** [March 28, 2025, 9:35pm UTC](https://discourse.julialang.org/t/julia-image-display-on-mac-goes-dark/127436/6 "2025-03-28T21:35:11Z")

</div>

I’ve now tried Chrome, Firefox, and Safari, as well as the macOS “preview” app and Affinity Photo; all produce similar results.

---

<div class="post-metadata">

**Author:** ![rmfritz](https://avatars.discourse-cdn.com/v4/letter/r/b487fb/32.png) [@rmfritz](https://discourse.julialang.org/u/rmfritz)\
**Post date:** [March 28, 2025, 9:40pm UTC](https://discourse.julialang.org/t/julia-image-display-on-mac-goes-dark/127436/7 "2025-03-28T21:40:04Z")

</div>

And I’ve also tried Julia ImageView from the command line which again produces dark results.

 ![image](https://global.discourse-cdn.com/julialang/original/3X/7/d/7d6a944b3386c51f511f67d6b152b370d74a6666.jpeg)

---

<div class="post-metadata">

**Author:** ![rmfritz](https://avatars.discourse-cdn.com/v4/letter/r/b487fb/32.png) [@rmfritz](https://discourse.julialang.org/u/rmfritz)\
**Post date:** [March 29, 2025, 1:36am UTC](https://discourse.julialang.org/t/julia-image-display-on-mac-goes-dark/127436/8 "2025-03-29T01:36:48Z")

</div>

And the answer is…

All the browsers, preview, and Affinity Photo apply a 𝛾 of .45 to the image before displaying it; Julia apparently does not.

 ![image](https://global.discourse-cdn.com/julialang/original/3X/e/9/e9f93179ea466c3697cb04da6d8fc7208f44618f.jpeg)

---

<div class="post-metadata">

**Author:** ![digital\_carver](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/digital_carver/32/33818_2.png) [@digital\_carver](https://discourse.julialang.org/u/digital_carver)\
**Post date:** [March 29, 2025, 10:19am UTC](https://discourse.julialang.org/t/julia-image-display-on-mac-goes-dark/127436/9 "2025-03-29T10:19:13Z")

</div>

Thanks for sharing the answer once you figured it out! That’s probably gonna help a bunch of folks in the future with the same issue.

Since you’re using Images.jl anyway, you can also use the `GammaCorrection` via `adjust_histogram` like in [this example](https://juliaimages.org/latest/examples/spatial_transformation/histogram_equalization/#Histogram-equalisation).

---

<div class="post-metadata">

**Author:** ![rmfritz](https://avatars.discourse-cdn.com/v4/letter/r/b487fb/32.png) [@rmfritz](https://discourse.julialang.org/u/rmfritz)\
**Post date:** [March 29, 2025, 7:57pm UTC](https://discourse.julialang.org/t/julia-image-display-on-mac-goes-dark/127436/10 "2025-03-29T19:57:25Z")

</div>

I figured that out this morning; `adjust_histogram(…, GammaCorrection(.45))` seems to do the same thing as my hack. It’s also an [open issue](https://github.com/JuliaGraphics/Colors.jl/issues/8) from ten years ago(!) on the JuliaGraphics GitHub.

When I get a few moments, I’m going to try it on Windows and see what happens.

---

<div class="post-metadata">

**Author:** ![rmfritz](https://avatars.discourse-cdn.com/v4/letter/r/b487fb/32.png) [@rmfritz](https://discourse.julialang.org/u/rmfritz)\
**Post date:** [March 30, 2025, 1:46am UTC](https://discourse.julialang.org/t/julia-image-display-on-mac-goes-dark/127436/11 "2025-03-30T01:46:59Z")

</div>

I did get a moment, uploaded several images, and they seem to have gotten lost. Possibly I shut the browser down before the upload finished. But, yes, the same issue occurs on Windows. It’s apparently an old issue, which perhaps has never even been discussed. Unfortunately, “RGB” is not standardized. (That has been discussed.) The common treatment of RGB data which doesn’t have a profile is to assume that a 𝛾 of .45 has been used, and reverse that on display by applying a 𝛾 of 2.2. Julia doesn’t do that.

[Here’s](https://www.cambridgeincolour.com/tutorials/gamma-correction.htm) a discussion of why using 𝛾 makes sense when using 8-bit RGB data from a photographic web site.
