Image Resizer : API Documentation

Type Instructions

Namespace ImageResizer

Parent QuerystringBase<TK>

Public instance methods

string ToQueryString()

Returns a URL-safe querystring containing the instruction set

Public properties

String[] AllKeys get;

Nullable<double> Alpha get; set;

Value between 0 and 1. Makes the rendered image transparent. Does not affect borders or background colors - those accept 4-byte colors with alpha channels, however. Requires the SimpleFilters plugin. Unless the output format is PNG, the image will be blended against white or the background color.

Nullable<AnchorLocation> Anchor get; set;

The alignment to use when cropping or padding the image automatically. Defaults to MiddleCenter.

Nullable<bool> AutoRotate get; set;

Automatically rotates images based on gravity sensor data embedded in Exif. Requires the AutoRotate plugin

string BackgroundColor get; set;

The color of margin and padding regions. Defaults to Transparent, or White (when jpeg is the selected output color).

Nullable<double> Blur get; set;

Guassian Blur. Requires the AdvancedFilters plugin.

BoxEdges Border get; set;

Friendly get/set accessor for the ["borderWidth"] value. Returns null when unspecified.

string BorderColor get; set;

The color to draw the border with, if a border width is specified.

Nullable<double> Brightness get; set;

-1..1 Adjust the brightness of the image. Requires the SimpleFilters plugin

string Builder get; set;

Specify the image processing pipeline to use. Defaults to 'gdi'. If FreeImageBuilder or WicBuilder is installed, you can specify 'freeimage' or 'wic' to use that pipeline instead. The WIC pipeline offers a 2-8X performance increase of GDI, at the expense of slightly reduced image quality, the full trust requirement, and support for only basic resize and crop commands. FreeImage offers *nix-level image support, and handles many images that gdi and wic can't deal with. It is also restricted to a subset of the full command series.

Nullable<ServerCacheMode> Cache get; set;

Allows disk caching to be forced or prevented.

Nullable<double> Contrast get; set;

-1..1 Adjust the contrast of the image. Requires the SimpleFilters plugin

int Count get;

Double[] CropRectange get; set;

An X1,Y1,X2,Y2 array of coordinates. Unless CropXUnits and CropYUnits are specified, these are in the coordinate space of the original image.

Double[] CropRectangle get; set;

An X1,Y1,X2,Y2 array of coordinates. Unless CropXUnits and CropYUnits are specified, these are in the coordinate space of the original image.

Nullable<double> CropXUnits get; set;

Defines the horizontal width of the crop rectangle's coordinate space. For example, setting this to 100 makes the crop X1 and X2 values percentages of the image width.

Nullable<double> CropYUnits get; set;

Defines the vertical height of the crop rectangle's coordinate space. For example, setting this to 100 makes the crop Y1 and Y1 values percentages of the image height.

string Decoder get; set;

Specify a preferred decoder for parsing the original image file. Defaults to 'gdi'. Other values include 'freeimage', 'wic', and 'psdreader'. The preferred decoder gets the first chance at reading the files. If that fails, all other decoders try, in order of declaration in Web.config. Requires the matching FreeImageDecoder, WicDecoder, or PsdReader plugin to be installed.

string Dither get; set;

Controls dithering when rendering to an 8-bit PNG or GIF image. Requires PrettyGifs or WicEncoder. Accepted values for PrettyGifs: true|false|4pass|30|50|79|[percentage]. Accepted values for WicEncoder: true|false.

string Encoder get; set;

Specify a preferred encoder for compressing the output image file. Defaults to 'gdi'. Other valid values are 'freeimage' and 'wic', which require the FreeImageEncoder and WicEncoder plugins respectively. FreeImage offers faster jpeg encoding, while WIC offers faster PNG and GIF encoding. Both, however, require full trust.

string FallbackImage get; set;

The fallback image to redirect to if the original image doesn't exist. Must be the name of a pre-defined 404 image or a filename in the default 404 images directory. Requires the Image404 plugin to be installed.

Nullable<FlipMode> FinalFlip get; set;

Flip instruction to perform after rendering is complete

string Format get; set;

Use 'OutputFormat' unless you need a custom value. Determines the format and encoding of the output image.

Nullable<int> Frame get; set;

The frame of the animated GIF to display. 1-based

Nullable<GrayscaleMode> Grayscale get; set;

Applies the specified kind of grayscale filter to the image. Requires the SimpleFilters plugin

Nullable<int> Height get; set;

The height in pixels to constrain the image to. See 'Mode' and 'Scale' for constraint logic.

Nullable<bool> IgnoreICC get; set;

If true, the ICC profile will be discared instead of being evaluated server side (which typically causes inconsistent and unexpected effects).

Nullable<bool> Invert get; set;

Applies a Negative filter to the image. Requires the SimpleFilters plugin

string Item get; set;

Nullable<int> JpegQuality get; set;

Determines Jpeg encoding quality. Maps to 'quality' setting.

Nullable<JpegSubsamplingMode> JpegSubsampling get; set;

Maps to 'subsampling'. Requires encoder=wic|freeimage or builder=wic|freeimage to take effect. Not supported by the GDI pipeline.

KeysCollection Keys get;

BoxEdges Margin get; set;

["margin"]: Gets/sets the width(s) of the margin outside the image border and effects.

Nullable<FitMode> Mode get; set;

The fit mode to use when both Width and Height are specified. Defaults to Pad.

Nullable<OutputFormat> OutputFormat get; set;

Selects the image encoding format. Maps to 'format'. Returns null if the format is unspecified or if it isn't defined in the enumeration.

BoxEdges Padding get; set;

["paddingWidth"]: Gets/sets the width(s) of padding inside the image border.

string PaddingColor get; set;

Defaults to 'bgcolor'. Allows a separate color to be used for padding areas vs. margins.

Nullable<int> Page get; set;

The page of the TIFF file to display. 1-based

Nullable<Byte> PaletteSize get; set;

Maps to 'colors'. Sets the palette size for the final png or gif image (not relevant for jpegs). Set to 'null' to use the largest palette size available in the format. Requires the PrettyGifs or WicEncoder plugin.

string Preset get; set;

The name of a pre-defined preset, or a comma-delimited list of presets to apply. These may overwrite other settings. Requires the Presets plugin.

Nullable<ProcessWhen> Process get; set;

Allows processing to be forced or prevented.

Nullable<double> RemoveNoise get; set;

Safe noise removal. Requires the AdvancedFilters plugin.

Nullable<double> Rotate get; set;

Maps to 'rotate'. Rotates the image during rendering. Arbitrary angles are supported.

Double[] RoundCorners get; set;

Gets or sets a 1 or 4-element array defining cornder radii. If the array is 1 element, it applies to all corners. If it is 4 elements, each corner gets an individual radius. Values are percentages of the image width or height, whichever is smaller. Requires the SimpleFilters plugin.

Nullable<double> Saturation get; set;

-1..1 Adjust the saturation of the image. Requires the SimpleFilters plugin

Nullable<ScaleMode> Scale get; set;

Control how upscaling is performed. Defaults to DownscaleOnly.

Nullable<bool> Sepia get; set;

Applies a Sepia filter to the image. Requires the SimpleFilters plugin

Nullable<double> Sharpen get; set;

Unsharp Mask. Requires the AdvancedFilters plugin.

Nullable<FlipMode> SourceFlip get; set;

Flip instruction to perform immediately after loading source image. Maps to 'sflip' and 'sourceFlip'.

Nullable<double> SourceRotate get; set;

Maps to 'srotate'. Rotates the source image prior to processing. Only 90 degree angles are currently supported.

Nullable<double> TrimPadding get; set;

Set TrimThreshold first. This specifies a percentage of the image size to 'add' to the crop rectangle. Setting to 0.5 or 1 usually produces good results. Requires the WhitespaceTrimmer plugin.

Nullable<Byte> TrimThreshold get; set;

Setting this enables automatic whitespace trimming using an energy function. 50 is safe, even 255 rarely cuts anything off except a shadow. Set TrimPadding to pad the result slightly and improve appearance. Requires the WhitespaceTrimmer plugin.

string Watermark get; set;

The name of a pre-defined watermark layer or group from Web.config, or a comma-delimited list of names. Requires the Watermark plugin.

Nullable<int> Width get; set;

The width in pixels to constrain the image to. See 'Mode' and 'Scale' for constraint logic.

Nullable<double> Zoom get; set;

A multiplier to apply to all sizing settings (still obeys Scale=down, though). Useful when you need to apply a page-wide scaling factor, such as for mobile devices.