anchor.diff:  is_blurred([{blur, _}|_]) -> true;
   is_blurred([_|Rest]) -> is_blurred(Rest).
   
  +is_lossless("image/gif") -> true;
  +is_lossless("image/png") -> true;
  +is_lossless(_) -> false.
   
   is_enabled(_F, []) -> false;
   is_enabled(F, [F|_]) -> true;
   is_enabled(F, [{F, Val}|_]) -> z_convert:to_bool(Val);
   is_enabled(F, [_|R]) -> is_enabled(F, R).
   
  +
  +add_optional_quality(Fs, true, _W, _H) ->
  +    Fs;
  +add_optional_quality(Fs, false, W, H) ->
  +    case proplists:is_defined(quality, Fs) of
  +        true -> Fs;
  +        false -> add_optional_quality_1(Fs, W*H)
  +    end.
  +
  +add_optional_quality_1(Fs, Pixels) when Pixels =< ?PIX_Q99 ->
  +    Fs ++ [{quality, 99}];
  +add_optional_quality_1(Fs, Pixels) when Pixels >= ?PIX_Q50 ->
  +    Fs ++ [{quality, 50}];
  +add_optional_quality_1(Fs, Pixels) ->
  +    % Calculate the quality on a lineair scale between PIX_Q50 and PIX_Q99
  +    Q = 99 - round(50 * (Pixels - ?PIX_Q99) / (?PIX_Q50 - ?PIX_Q99)),
  +    Fs ++ [{quality, Q}].
   
   %% @spec out_mime(Mime, Options) -> {Mime, Extension}
   %% @doc Return the preferred mime type of the image generated by resizing an image of a certain type and size.
  
positive.code:     out_mime/2,
      string2filter/2,
      cmd_args/3,
      calc_size/7
  ]).
  
  -define(MAX_WIDTH,  5000).
  -define(MAX_HEIGHT, 5000).
  
  -include_lib("zotonic.hrl").
  
  
negative.code:             lists:flatten(z_utils:combine(32, CmdArgs)), " ",
              z_utils:os_filename(OutFile)
          ]),
          lager:debug("Image Preview: ~p", [Cmd]),
          Result = z_media_preview_server:exec(Cmd, OutFile),
          case filelib:is_regular(OutFile) of
              true ->
  