anchor.diff:                  ReqWidth   = z_convert:to_integer(proplists:get_value(width, Filters)),
                   ReqHeight  = z_convert:to_integer(proplists:get_value(height, Filters)),
                   {CropPar,_Filters1} = fetch_crop(Filters),
  -                {ResizeWidth,ResizeHeight,CropArgs} = calc_size(ReqWidth, ReqHeight, ImageWidth, ImageHeight, CropPar, Orientation),
  +                {ResizeWidth,ResizeHeight,CropArgs} = calc_size(ReqWidth, ReqHeight, ImageWidth, ImageHeight, CropPar, Orientation, is_enabled(upscale, Filters)),
                   case CropArgs of
                       none -> 
                           case is_enabled(extent, Filters) of
  
positive.code: 
  
  %%@doc Calculate the size of the resulting image, depends on the crop and the original image size
  calc_size(Width, Height, ImageWidth, ImageHeight, CropPar, Orientation) when Orientation >= 5 ->
      calc_size(Width, Height, ImageHeight, ImageWidth, CropPar, 1);
  
  calc_size(undefined, undefined, ImageWidth, ImageHeight, _CropPar, _Orientation) ->
      {ImageWidth, ImageHeight, none};
  
  calc_size(undefined, Height, ImageWidth, ImageHeight, CropPar, Orientation) ->
      Width = round((ImageWidth / ImageHeight) * Height),
      calc_size(Width, Height, ImageWidth, ImageHeight, CropPar, Orientation);
  
  calc_size(Width, undefined, ImageWidth, ImageHeight, CropPar, Orientation) when CropPar /= none ->
      calc_size(Width, Width, ImageWidth, ImageHeight, CropPar, Orientation);
  
  calc_size(undefined, Height, ImageWidth, ImageHeight, CropPar, Orientation) when CropPar /= none ->
      calc_size(Height, Height, ImageWidth, ImageHeight, CropPar, Orientation);
  
  calc_size(Width, undefined, ImageWidth, ImageHeight, CropPar, Orientation) ->
      Height = round((ImageHeight / ImageWidth) * Width),
      calc_size(Width, Height, ImageWidth, ImageHeight, CropPar, Orientation);
  
  calc_size(Width, Height, ImageWidth, ImageHeight, CropPar, _Orientation) ->
      ImageAspect = ImageWidth / ImageHeight,
      Aspect      = Width / Height,
      case CropPar of
  
negative.code:     {Width, Height, []};
  filter2arg({height, _}, Width, Height) ->
      {Width, Height, []};
  filter2arg({resize, Width, Height, _}, Width, Height) ->
      {Width, Height, []};
  filter2arg({resize, EndWidth, EndHeight, false}, Width, Height) 
    when Width =< EndWidth andalso Height =< EndHeight ->
      % Prevent scaling up, perform an extent instead
      GArg = "-gravity West",
      EArg = ["-extent ", integer_to_list(EndWidth),$x,integer_to_list(EndHeight)],
      % Still thumbnail to remove extra info from the image
      RArg = ["-thumbnail ", z_utils:os_escape([integer_to_list(EndWidth),$x,integer_to_list(EndHeight),$!])],
      {EndWidth, EndHeight, [GArg, 32, EArg, 32, RArg]};
  filter2arg({resize, EndWidth, EndHeight, true}, Width, Height) 
    when Width < EndWidth andalso Height < EndHeight ->
      % Scale up
      EArg = ["-resize ", integer_to_list(EndWidth),$x,integer_to_list(EndHeight)],
      RArg = ["-thumbnail ", z_utils:os_escape([integer_to_list(EndWidth),$x,integer_to_list(EndHeight),$!])],
  