Browse files

core: Add 'default_colorspace' global option to set the default Image…

…Magick colorspace

In some ImageMagick versions, the default "sRGB" color space results
in resized images that are too dark.

The new default_colorspace global config setting allows to override
the color space with another one, like "RGB".

This solution was inspired on the similar fix in Typo3:
  • Loading branch information...
1 parent 69ac261 commit bcc12c158696ef4642431da3b23bbe7e3c619857 @arjan arjan committed Mar 17, 2013
Showing with 4 additions and 1 deletion.
  1. +3 −0 priv/
  2. +1 −1 src/support/z_media_preview.erl
3 priv/
@@ -87,6 +87,9 @@
%% Webmachine error handler, you can use your own.
% {webmachine_error_handler,z_webmachine_error_handler},
+ %% Default ImageMagick color space. Some ImageMagick versions (like 6.7.0 and above) use the RGB colorspace, so all images are darker then the original. <br />Possible Values: CMY, CMYK, Grey, HCL, HSB, HSL, HWB, Lab, LCH, LMS, Log, Luv, OHTA, Rec601Luma, Rec601YCbCr, Rec709Luma, Rec709YCbCr, RGB, sRGB, Transparent, XYZ, YCbCr, YCC, YIQ, YCbCr, YUV
+ % {default_colorspace, "sRGB"},
% Date this file was created/updated
{modify_date, {{2010,7,12},{12,28,30}}}
2 src/support/z_media_preview.erl
@@ -166,7 +166,7 @@ cmd_args(FileProps, Filters, OutMime) ->
{correct_orientation, Orientation},
{resize, ResizeWidth, ResizeHeight, is_enabled(upscale, Filters)},
{crop, CropArgs},
- {colorspace, "sRGB"} | Filters1],
+ {colorspace, z_config:get(default_colorspace, "sRGB")} | Filters1],
Filters3 = case {CropArgs,is_enabled(extent, Filters)} of
{none,true} -> Filters2 ++ [{extent, ReqWidth, ReqHeight}];
_ -> Filters2

0 comments on commit bcc12c1

Please sign in to comment.