# Image Embedded Color Profile

**URL:** https://meta.discourse.org/t/image-embedded-color-profile/40519
**Category:** Bug
**Created:** [March 3, 2016, 5:36pm UTC](https://meta.discourse.org/t/image-embedded-color-profile/40519 "2016-03-03T17:36:58Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![Patrick\_David](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/patrick_david/32/119657_2.png) [@Patrick\_David](https://meta.discourse.org/u/Patrick_David)
#### Post date: [March 3, 2016, 5:36pm UTC](https://meta.discourse.org/t/image-embedded-color-profile/40519/1 "2016-03-03T17:36:58Z")

</div>

Not sure if this showed up somewhere else (the search terms, _color profile embedded_ return unassociated results.. 🙂 ).

I run a Free Software photography forum over at [discuss.pixls.us](https://discuss.pixls.us). As you might imagine, we have users that are very particular about how their images are displayed.

One thing we ran into recently was problems on a thread about color management:

> **[Correct way to work with color managed applications?](https://discuss.pixls.us/t/correct-way-to-work-with-color-managed-applications/954/5?u=patdavid)**
>
> Short addendum to what @Morgan\_Hardwood wrote: The part that gets loaded into the GPU is called vcgt and is just a gamma correction. It will not change the colors. So don’t confuse it with full screen color correction which might come with Wayland...

One of the photographers noticed that the functionality of fetching linked images and storing them locally seems to strip the color information from the images. While this may be fine to save space on most forums, for a photography forum this is a bit painful. ☹

To illustrate, this image has a rotated embedded color profile. It _should_ show (Rot = Red, Grün = Green, Blau = Blue):

 ![farbkreis](https://global.discourse-cdn.com/meta/original/4X/1/2/3/1233436a9cc75fb82ccf7f4442f2443de4af12d9.jpeg)  
The source image I embedded in the post above can be found here:

[https://houz.org/tmp/farbkreis.jpg](https://houz.org/tmp/farbkreis.jpg)

Here is the same image, uploaded directly to the forum:

 ![](https://global.discourse-cdn.com/meta/original/3X/7/8/783f7d57ef0c8d97a80c21ed51df8512861231a3.jpg)

Is the image processing being done with imagemagick? If so, is there any thought to possibly adding an option to convert uploaded image to sRGB and to tag them as such before saving?

(I’d be happy to investigate further if someone could point me to the relevant bits of code that handle image conversion when uploaded?)

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [March 4, 2016, 2:53am UTC](https://meta.discourse.org/t/image-embedded-color-profile/40519/2 "2016-03-04T02:53:06Z")

</div>

Sure check with @zogstrip.

---

<div class="post-metadata">

### Author: ![Patrick\_David](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/patrick_david/32/119657_2.png) [@Patrick\_David](https://meta.discourse.org/u/Patrick_David)
#### Post date: [March 4, 2016, 5:07pm UTC](https://meta.discourse.org/t/image-embedded-color-profile/40519/3 "2016-03-04T17:07:05Z")

</div>

@zogstrip - is the conversion being done using imagemagick? If so, would you mind pointing me to the relevant section?

It appears that we may only need an option to convert any images to sRGB _if_ they have a different profile embedded, and then either strip the profile or specify that the image is now sRGB.

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [March 4, 2016, 6:17pm UTC](https://meta.discourse.org/t/image-embedded-color-profile/40519/4 "2016-03-04T18:17:17Z")

</div>

> [@Patrick\_David](#):
>
> is the conversion being done using imagemagick?

We do the resizing with `convert` but then the thumbnail is optimised using `optipng`.

You will find everything you need to know in [`OptimizedImage`](https://github.com/discourse/discourse/blob/master/app/models/optimized_image.rb) and more specifically

> <https://github.com/discourse/discourse/blob/main/app/models/optimized_image.rb#L102-L111>

---

<div class="post-metadata">

### Author: ![darix](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/darix/32/114280_2.png) [@darix](https://meta.discourse.org/u/darix)
#### Post date: [March 7, 2016, 10:43pm UTC](https://meta.discourse.org/t/image-embedded-color-profile/40519/5 "2016-03-07T22:43:51Z")

</div>

Tested fix:

[https://github.com/discourse/discourse/pull/4064](https://github.com/discourse/discourse/pull/4064)

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [July 18, 2018, 5:50am UTC](https://meta.discourse.org/t/image-embedded-color-profile/40519/6 "2018-07-18T05:50:23Z")

</div>

This still does not look fixed to me… I just tried with the image on the OP.

@tgxworld as part of your image magick 7 upgrade can you test this?

---

<div class="post-metadata">

### Author: ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)
#### Post date: [July 24, 2018, 11:49am UTC](https://meta.discourse.org/t/image-embedded-color-profile/40519/8 "2018-07-24T11:49:37Z")

</div>

This is actually a result of `ImageOptim` and not ImageMagick. We probably don’t want to be stripping the ICC profile here?

> - `:strip` — List of extra markers to strip: `:comments` , `:exif` , `:iptc` , `:icc` or `:all`_(defaults to `:all` )_

> <https://github.com/discourse/discourse/blob/c3b6811651c46a533c2f2b7f3c0878cd1f3457a1/lib/file_helper.rb#L91>

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [July 24, 2018, 3:10pm UTC](https://meta.discourse.org/t/image-embedded-color-profile/40519/9 "2018-07-24T15:10:55Z")

</div>

Probably `:comments` is what we want there?

---

<div class="post-metadata">

### Author: ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)
#### Post date: [July 25, 2018, 12:20am UTC](https://meta.discourse.org/t/image-embedded-color-profile/40519/10 "2018-07-25T00:20:59Z")

</div>

I was thinking about this and this seems very specific to a photography forum. If they want to keep all the metadata/color profile, they can just set `SiteSetting.strip_image_metadata` to `false`. For majority of the images, keeping the exif or iptc metadata isn’t going to be very useful.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [July 25, 2018, 12:46am UTC](https://meta.discourse.org/t/image-embedded-color-profile/40519/11 "2018-07-25T00:46:46Z")

</div>

Interesting @Patrick_David, so this is not really a bug… it is a feature request to allow for fidelity when stripping exif tags (or simply misunderstanding an existing feature)

I am going to close this for now, but feel free to open a new topic if you find setting `strip_image_metadata` to false unacceptable.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [July 25, 2018, 12:46am UTC](https://meta.discourse.org/t/image-embedded-color-profile/40519/12 "2018-07-25T00:46:49Z")

</div>


