public void Should_return_a_new_image_object() { //Arrange //Act var result1 = _image.AddParameter("test1", "test1"); var result2 = _image.AddParameter("test2", "test2"); //Assert Assert.AreNotEqual(result1.Url, result2.Url); Assert.False(result1.Url.Contains("test2")); Assert.False(result2.Url.Contains("test1")); }
/// <summary> /// Adds the blur parameter /// </summary> /// <param name="image">The image to transform</param> /// <param name="value"> /// Values: 0-1000 /// Default: 0 /// </param> /// <returns></returns> public static ImgixImage Blur(this ImgixImage image, int value) => image.AddParameter("blur", value);
/// <summary> /// Sets the width of the transformed image. /// </summary> /// <param name="image">The image to transform</param> /// <param name="width">The width value as a string</param> /// <returns></returns> public static ImgixImage Width(this ImgixImage image, string width) => image.AddParameter("w", width);
/// <summary> /// Selects a sub-reqion of the image to use for processing /// </summary> /// <param name="image">The image to transform</param> /// <param name="dimensions"> /// A comma seperated string of integers of the format "x,y,width,height" /// </param> /// <returns></returns> public static ImgixImage Rect(this ImgixImage image, string dimensions) => image.AddParameter("rect", dimensions);
/// <summary> /// SEts the oputput quality of the image /// </summary> /// <param name="image">The image to transform</param> /// <param name="value"> /// Values: 0-100 /// Default: 75 /// </param> /// <returns></returns> public static ImgixImage Quality(this ImgixImage image, int value) => image.AddParameter("q", value);
/// <summary> /// Sets the output format of the image. /// </summary> /// <param name="image">The image to transform</param> /// <param name="value"> /// The format name /// Values: gif, jp2, jpg, json, jxr, pjpg, mp4, png, png8, png32, webp /// </param> /// <returns></returns> public static ImgixImage OutputFormat(this ImgixImage image, string value) => image.AddParameter("fm", value);
/// <summary> /// When used in an a tag forces download with the specified name /// </summary> /// <param name="image">The image to transform</param> /// <param name="value"> /// The download name of the image /// </param> /// <returns></returns> public static ImgixImage Download(this ImgixImage image, string value) => image.AddParameter("dl", value);
/// <summary> /// Chroma subsampling for JPEG and Progressive JPEG /// </summary> /// <param name="image">The image to transform</param> /// <param name="value"> /// Values: 420, 422, and 444 /// Default: 420 /// </param> /// <returns></returns> public static ImgixImage ChromaSubsampling(this ImgixImage image, int value) => image.AddParameter("chromasub", value);
/// <summary> /// Will add an auto enhancement parameter to the url /// </summary> /// <param name="image">The image to transform</param> /// <param name="value"> /// The value of the auto parameter /// Values: enhance, format, redeye /// </param> /// <returns></returns> public static ImgixImage Auto(this ImgixImage image, string value) => image.AddParameter("auto", value);
/// <summary> /// Adds a mask parameter with the supplied string as value /// </summary> /// <param name="image">The image to transform</param> /// <param name="value">The value of the mask parameter</param> /// <returns></returns> public static ImgixImage Mask(this ImgixImage image, string value) => image.AddParameter("mask", value);
/// <summary> /// Adds a mask parameter with the value ellipse /// </summary> /// <param name="image">The image to transform</param> /// <returns></returns> public static ImgixImage EllipseMask(this ImgixImage image) => image.AddParameter("mask", "ellipse");
/// <summary> /// Adds a sepia toning effect to the image /// </summary> /// <param name="image">The image to transform</param> /// <param name="value"> /// Values: 0-100 /// Default: 0 (No change) /// </param> /// <returns></returns> public static ImgixImage SepiaTone(this ImgixImage image, int value) => image.AddParameter("sepia", value);
/// <summary> /// Adds a pixellation effect /// </summary> /// <param name="image">The image to transform</param> /// <param name="value"> /// Values: 0-100 /// Default: 0 (No change) /// </param> /// <returns></returns> public static ImgixImage Pixellate(this ImgixImage image, int value) => image.AddParameter("px", value);
/// <summary> /// Does a monochromatic hue change. /// </summary> /// <param name="image">The image to transform</param> /// <param name="value"> /// 3, 6 or 8 digit hex value /// </param> /// <returns></returns> public static ImgixImage Monochrome(this ImgixImage image, string value) => image.AddParameter("mono", value);
/// <summary> /// Adds a half-toning effect to the image /// </summary> /// <param name="image">The image to transform</param> /// <param name="value"> /// Values: 0-100 /// Default: 0 /// </param> /// <returns></returns> public static ImgixImage HalfTone(this ImgixImage image, int value) => image.AddParameter("htn", value);
/// <summary> /// Sets the border around the image. /// </summary> /// <param name="image">The image to transform</param> /// <param name="value"> /// A String describing the border. /// Value: size,color /// Size: An integer value /// Color: An RGB or ARGB value /// </param> /// <returns></returns> public static ImgixImage Border(this ImgixImage image, string value) => image.AddParameter("border", value);
/// <summary> /// Adds ch parameter opting in to using client hints. /// </summary> /// <param name="image">The image to transform</param> /// <param name="value"> /// A comma seperated list of hints /// Values: Width and DPR are currently supported /// </param> /// <returns></returns> public static ImgixImage ClientHints(this ImgixImage image, string value) => image.AddParameter("ch", value);
/// <summary> /// Will add an auto enhancement parameter to the url /// </summary> /// <param name="image">The image to transform</param> /// <param name="values"> /// One or more AutoOperations /// </param> /// <returns></returns> public static ImgixImage Auto(this ImgixImage image, params AutoOperation[] values) => image.AddParameter("auto", string.Join(",", values.Select(at => at.ToString().ToLower()).ToArray()));
/// <summary> /// Adds color quantization to the image, limiting the amount of colors in the image. /// </summary> /// <param name="image">The image to transform</param> /// <param name="value"> /// Values: 2-256 /// </param> /// <returns></returns> public static ImgixImage ColorQuantization(this ImgixImage image, int value) => image.AddParameter("colorquant", value);
/// <summary> /// Adds the timecolor parameter to the image url /// </summary> /// <param name="image">The image to transform</param> /// <param name="value"> /// A three or six char hex color string /// </param> /// <returns></returns> public static ImgixImage TrimColor(this ImgixImage image, string value) => image.AddParameter("trimcolor", value);
/// <summary> /// Sets the DPI value in the Exif header /// </summary> /// <param name="image">The image to transform</param> /// <param name="value"> /// The DPI value /// </param> /// <returns></returns> public static ImgixImage DPI(this ImgixImage image, int value) => image.AddParameter("dpi", value);
/// <summary> /// The difference threshhold used when trimming a border. /// Only valid when trim is set to auto /// </summary> /// <param name="image">The image to transform</param> /// <param name="value"> /// A lower value makes the trimming more aggressive /// Default: 11 /// </param> /// <returns></returns> public static ImgixImage TrimMeanDifference(this ImgixImage image, int value) => image.AddParameter("trimmd", value);
/// <summary> /// Should the returned image be lossless /// </summary> /// <param name="image">The image to transform</param> /// <param name="value"> /// Values: 0, 1, true, false /// </param> /// <returns></returns> public static ImgixImage Lossless(this ImgixImage image, string value) => image.AddParameter("lossless", value);
/// <summary> /// Defines the standard deviation among pixels in a border. /// Only valid when trim is set to auto /// </summary> /// <param name="image">The image to transform</param> /// <param name="value"> /// The standard deviation /// Default: 10 /// </param> /// <returns></returns> public static ImgixImage TrimStandardDeviation(this ImgixImage image, int value) => image.AddParameter("trimsd", value);
/// <summary> /// How is the output image fit into the target dimensions. /// </summary> /// <param name="image">The image to transform</param> /// <param name="fit"> /// The fit mode /// Values: clamp, clip, crop, facearea, fill, max, min, scale /// </param> /// <returns></returns> public static ImgixImage Fit(this ImgixImage image, string fit) => image.AddParameter("fit", fit);
/// <summary> /// DEfines the tolerance when trim has been set to color. /// </summary> /// <param name="image">The image to transform</param> /// <param name="value"> /// The tolerance /// Default: 0 /// </param> /// <returns></returns> public static ImgixImage TrimTolerance(this ImgixImage image, int value) => image.AddParameter("trimtol", value);
/// <summary> /// Sets the height of the transformed image. /// </summary> /// <param name="image">The image to transform</param> /// <param name="height">The height value as a string</param> /// <returns></returns> public static ImgixImage Height(this ImgixImage image, string height) => image.AddParameter("h", height);
/// <summary> /// Adds a background color to the image if there is transparency in it /// </summary> /// <param name="image">The image to transform</param> /// <param name="value"> /// 3, 4, 6 and 8 character color values /// </param> /// <returns></returns> public static ImgixImage BackgroundColor(this ImgixImage image, string value) => image.AddParameter("bg", value);
/// <summary> /// Controls how the image is aligned when fit has been set to crop /// </summary> /// <param name="image">The image to transform</param> /// <param name="cropMode"> /// The crop mode value. Can be a comma seperated list. /// Values: top, bottom, left, right, faces, entropy /// </param> /// <returns></returns> public static ImgixImage Crop(this ImgixImage image, string cropMode) => image.AddParameter("crop", cropMode);
/// <summary> /// Adds padding to the image. /// If the image does not have any size parameters the padding will extend the picture. /// If there are size parameters, the image will be shrunk to fit /// </summary> /// <param name="image">The image to transform</param> /// <param name="value"> /// The thickness of the padding. /// </param> /// <returns></returns> public static ImgixImage Padding(this ImgixImage image, int value) => image.AddParameter("pad", value);