# Uploading Grayscale images causes the image to be darkened

**URL:** <https://meta.discourse.org/t/uploading-grayscale-images-causes-the-image-to-be-darkened/24616>\
**Category:** Bug\
**Created:** [2015 年 1 月 30 日午後 3:10 UTC](https://meta.discourse.org/t/uploading-grayscale-images-causes-the-image-to-be-darkened/24616 "2015-01-30T15:10:33Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![anon25879736](https://avatars.discourse-cdn.com/v4/letter/a/e95f7d/32.png) [@anon25879736](https://meta.discourse.org/u/anon25879736)\
**Post date:** [2015 年 1 月 30 日午後 3:10 UTC](https://meta.discourse.org/t/uploading-grayscale-images-causes-the-image-to-be-darkened/24616/1 "2015-01-30T15:10:34Z")

</div>

Uploading a purely grayscale image causes the image to be darkened when displayed by discourse. This applies to images in posts, as well as images uploaded as avatars. for example, take this image:

![](https://global.discourse-cdn.com/meta/original/3X/c/3/c3371060c5a43fdaf8edf51ac4d2699f62bdec07.png)

This is much darker that the image is supposed to be. However, if I shift the R,G, or B value of a single pixel, it will display correctly. In this case, I have shifted the top left pixel from (172,172,172) to (173,172,172). This is the _only_ change I have made between the source images.

![](https://global.discourse-cdn.com/meta/original/3X/4/6/46e855c9528f8c55a640246e80a0a161f5786586.png)

Now, because of the R value being shifted in one pixel, the image is being displayed accurately.

Unfortunately, this fix is not reliable for avatars. Once the image is scaled down, the shifted pixel gets lost and the smaller image gets darkened again. As a result, you can end up with a grab bag of light and dark avatars. To make it work for avatars, you pretty much need to shift a region of pixels, instead of just a single pixel.

---

_[View the full topic](https://meta.discourse.org/t/uploading-grayscale-images-causes-the-image-to-be-darkened/24616)._
