public static OutputImage ToOutputImage(this ITaskItem item)
        {
            var paddingString = item.GetMetadata(nameof(OutputImage.PaddingFactor));
            var image         = new OutputImage
            {
                InputFile       = item.GetMetadata(nameof(OutputImage.InputFile)),
                OutputFile      = item.ItemSpec,
                OutputLink      = item.GetMetadata(nameof(OutputImage.OutputLink)),
                BackgroundColor = item.GetMetadata(nameof(OutputImage.BackgroundColor)),
                PaddingColor    = item.GetMetadata(nameof(OutputImage.PaddingColor)),
                PaddingFactor   = !string.IsNullOrEmpty(paddingString) && double.TryParse(paddingString, out var p) ? p : default
            };

            int.TryParse(item.GetMetadata(nameof(OutputImage.Height)), out var height);
            int.TryParse(item.GetMetadata(nameof(OutputImage.Width)), out var width);
            bool.TryParse(item.GetMetadata(nameof(OutputImage.RequiresBackgroundColor)), out var requiresBackgroundColor);
            bool.TryParse(item.GetMetadata(nameof(OutputImage.ShouldBeVisible)), out var shouldBeVisible);
            if (double.TryParse(item.GetMetadata(nameof(OutputImage.Scale)), out var scale) && (height == 0 || width == 0) && scale == 0)
            {
                scale = 1;
            }

            image.Height = height;
            image.Width  = width;
            image.RequiresBackgroundColor = requiresBackgroundColor;
            image.ShouldBeVisible         = shouldBeVisible;
            image.Scale = scale;

            var watermarkSourceFile = item.GetMetadata("WatermarkSourceFile");
            var watermarkText       = item.GetMetadata("WatermarkText");
            var opacityString       = item.GetMetadata("WatermarkOpacity");
            var opacity             = double.TryParse(opacityString, out var op) ? op : Constants.DefaultOpacity;

            if (!string.IsNullOrEmpty(watermarkSourceFile))
            {
                image.Watermark = new WatermarkConfiguration
                {
                    SourceFile = watermarkSourceFile,
                    Opacity    = opacity
                };
            }
            else if (!string.IsNullOrEmpty(watermarkText))
            {
                image.Watermark = new WatermarkConfiguration
                {
                    Text       = watermarkText,
                    TextColor  = item.GetMetadata("WatermarkTextColor", "White"),
                    FontFamily = item.GetMetadata("WatermarkFontFamily", "Arial"),
                    FontFile   = item.GetMetadata("WatermarkFontFile"),
                    Position   = item.GetEnumFromMetadata("WatermarkPosition", WatermarkPosition.BottomRight),
                    Opacity    = opacity
                };
                var colors = item.GetMetadata("WatermarkColors", "Red,OrangeRed");
                image.Watermark.Colors = colors.Split(',').ToArray();
            }

            return(image);
        }