Use sRGB Color Profile when converting images

With the conversion done when uploading or fetching an image we also
lose any embedded color profiles. [This leads to images possibly not rendered
properly in the browsers.][1] To fix the issue we tell imagemagick to render
the image from the embedded color profile to sRGB, which is the color
space used by most browsers.

RT_sRGB.icm is taken from the [RawTherapee repository][2] and is licensed as Public Domain.

[1]: https://meta.discourse.org/t/image-embedded-color-profile/40519
[2]: https://github.com/Beep6581/RawTherapee/blob/master/rtdata/iccprofiles/output/RT_sRGB.icm
This commit is contained in:
Marcus Rückert 2016-03-07 23:26:28 +01:00
parent 74e4251aff
commit 320d5d64e8
2 changed files with 2 additions and 0 deletions

View File

@ -108,6 +108,7 @@ class OptimizedImage < ActiveRecord::Base
-interpolate bicubic
-unsharp 2x0.5+0.7+0
-quality 98
-profile #{File.join(Rails.root, 'vendor', 'data', 'RT_sRGB.icm')}
#{to}
}
end
@ -130,6 +131,7 @@ class OptimizedImage < ActiveRecord::Base
-gravity center
-background transparent
-resize #{dimensions}#{!!opts[:force_aspect_ratio] ? "\\!" : "\\>"}
-profile #{File.join(Rails.root, 'vendor', 'data', 'RT_sRGB.icm')}
#{to}
}
end

BIN
vendor/data/RT_sRGB.icm vendored Normal file

Binary file not shown.