Image Embedded Color Profile

Not sure if this showed up somewhere else (the search terms, color profile embedded return unassociated results… :slight_smile: ).

I run a Free Software photography forum over at 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:

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. :frowning:

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

The source image I embedded in the post above can be found here:

https://houz.org/tmp/farbkreis.jpg

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

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?)

5 Likes

Sure check with @zogstrip.

@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.

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

You will find everything you need to know in OptimizedImage and more specifically

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

3 Likes

Tested fix:

https://github.com/discourse/discourse/pull/4064

3 Likes

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?

3 Likes

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

3 Likes

Probably :comments is what we want there?

1 Like

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.

2 Likes

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.

5 Likes