ImageResizer  3.4.0
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events
Public Member Functions | Properties | List of all members
ImageResizer.Instructions Class Reference

A name/value collection of image processsing instructions. The successor to ResizeSettings. Just because a key doesn't have a property wrapper doesn't mean you can't use it. i["key"] = value; isnt' that scary. More...

Inheritance diagram for ImageResizer.Instructions:
Inheritance graph
[legend]
Collaboration diagram for ImageResizer.Instructions:
Collaboration graph
[legend]

Public Member Functions

override string ToString ()
 Returns a human-friendly representation of the instruction set. Not suitable for URL usage; use ToQueryString() for that. More...
 
string ToQueryString ()
 Returns a URL-safe querystring containing the instruction set More...
 
 Instructions ()
 Creates an empty instructions collection. More...
 
 Instructions (NameValueCollection col)
 Copies the specified collection into a new Instructions instance. More...
 
 Instructions (string queryString)
 Parses the specified querystring into name/value pairs. Supports standard and semicolon syntaxes. The most readable format is 'key=value;key2=value2' Discards everything after the first '#' character as a URL fragment. More...
 

Properties

int Width [get, set]
 The width in pixels to constrain the image to. See 'Mode' and 'Scale' for constraint logic. More...
 
int Height [get, set]
 The height in pixels to constrain the image to. See 'Mode' and 'Scale' for constraint logic. More...
 
FitMode Mode [get, set]
 The fit mode to use when both Width and Height are specified. Defaults to Pad. More...
 
AnchorLocation Anchor [get, set]
 The alignment to use when cropping or padding the image automatically. Defaults to MiddleCenter. More...
 
FlipMode SourceFlip [get, set]
 Flip instruction to perform immediately after loading source image. Maps to 'sflip' and 'sourceFlip'. More...
 
FlipMode FinalFlip [get, set]
 Flip instruction to perform after rendering is complete More...
 
ScaleMode Scale [get, set]
 Control how upscaling is performed. Defaults to DownscaleOnly. More...
 
ServerCacheMode Cache [get, set]
 Allows disk caching to be forced or prevented. More...
 
ProcessWhen Process [get, set]
 Allows processing to be forced or prevented. More...
 
int Frame [get, set]
 The frame of the animated GIF to display. 1-based More...
 
int Page [get, set]
 The page of the TIFF file to display. 1-based More...
 
int JpegQuality [get, set]
 Determines Jpeg encoding quality. Maps to 'quality' setting. More...
 
JpegSubsamplingMode JpegSubsampling [get, set]
 Maps to 'subsampling'. Requires encoder=wic|freeimage or builder=wic|freeimage to take effect. Not supported by the GDI pipeline. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
bool AutoRotate [get, set]
 Automatically rotates images based on gravity sensor data embedded in Exif. Requires the AutoRotate plugin More...
 
double SourceRotate [get, set]
 Maps to 'srotate'. Rotates the source image prior to processing. Only 90 degree angles are currently supported. More...
 
double Rotate [get, set]
 Maps to 'rotate'. Rotates the image during rendering. Arbitrary angles are supported. More...
 
string Format [get, set]
 Use 'OutputFormat' unless you need a custom value. Determines the format and encoding of the output image. More...
 
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. More...
 
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). More...
 
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. More...
 
string BackgroundColor [get, set]
 The color of margin and padding regions. Defaults to Transparent, or White (when jpeg is the selected output color). More...
 
string PaddingColor [get, set]
 Defaults to 'bgcolor'. Allows a separate color to be used for padding areas vs. margins. More...
 
string BorderColor [get, set]
 The color to draw the border with, if a border width is specified. More...
 
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. More...
 
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. More...
 
bool Invert [get, set]
 Applies a Negative filter to the image. Requires the SimpleFilters plugin More...
 
bool Sepia [get, set]
 Applies a Sepia filter to the image. Requires the SimpleFilters plugin More...
 
GrayscaleMode Grayscale [get, set]
 Applies the specified kind of grayscale filter to the image. Requires the SimpleFilters plugin More...
 
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. More...
 
double Brightness [get, set]
 -1..1 Adjust the brightness of the image. Requires the SimpleFilters plugin More...
 
double Contrast [get, set]
 -1..1 Adjust the contrast of the image. Requires the SimpleFilters plugin More...
 
double Saturation [get, set]
 -1..1 Adjust the saturation of the image. Requires the SimpleFilters plugin More...
 
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. More...
 
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. More...
 
double Blur [get, set]
 Guassian Blur. Requires the AdvancedFilters plugin. More...
 
double Sharpen [get, set]
 Unsharp Mask. Requires the AdvancedFilters plugin. More...
 
double RemoveNoise [get, set]
 Safe noise removal. Requires the AdvancedFilters plugin. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
BoxEdges Padding [get, set]
 ["paddingWidth"]: Gets/sets the width(s) of padding inside the image border. More...
 
BoxEdges Margin [get, set]
 ["margin"]: Gets/sets the width(s) of the margin outside the image border and effects. More...
 
BoxEdges Border [get, set]
 Friendly get/set accessor for the ["borderWidth"] value. Returns null when unspecified. More...
 

Detailed Description

A name/value collection of image processsing instructions. The successor to ResizeSettings. Just because a key doesn't have a property wrapper doesn't mean you can't use it. i["key"] = value; isnt' that scary.

Definition at line 15 of file Instructions.cs.

Constructor & Destructor Documentation

ImageResizer.Instructions.Instructions ( )
inline

Creates an empty instructions collection.

Definition at line 66 of file Instructions.cs.

66 : base() { }
ImageResizer.Instructions.Instructions ( NameValueCollection  col)
inline

Copies the specified collection into a new Instructions instance.

Parameters
col

Definition at line 71 of file Instructions.cs.

71 : base(col) { }
ImageResizer.Instructions.Instructions ( string  queryString)
inline

Parses the specified querystring into name/value pairs. Supports standard and semicolon syntaxes. The most readable format is 'key=value;key2=value2' Discards everything after the first '#' character as a URL fragment.

Parameters
queryString

Definition at line 76 of file Instructions.cs.

A set of utility methods for manipulating virtual paths
Definition: PathUtils.cs:17
static NameValueCollection ParseQueryStringFriendlyAllowSemicolons(string path)
Like ParseQueryString, but permits the leading '?' to be omitted, and semicolons can be substituted f...
Definition: PathUtils.cs:322

Member Function Documentation

string ImageResizer.Instructions.ToQueryString ( )
inline

Returns a URL-safe querystring containing the instruction set

Returns

Definition at line 59 of file Instructions.cs.

59  {
60  return PathUtils.BuildQueryString(this, true);
61  }
override string ImageResizer.Instructions.ToString ( )
inline

Returns a human-friendly representation of the instruction set. Not suitable for URL usage; use ToQueryString() for that.

Returns

Definition at line 51 of file Instructions.cs.

51  {
52  return PathUtils.BuildSemicolonQueryString(this, false);
53  }

Property Documentation

double ImageResizer.Instructions.Alpha
getset

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.

Definition at line 255 of file Instructions.cs.

AnchorLocation ImageResizer.Instructions.Anchor
getset

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

Definition at line 96 of file Instructions.cs.

bool ImageResizer.Instructions.AutoRotate
getset

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

Definition at line 178 of file Instructions.cs.

string ImageResizer.Instructions.BackgroundColor
getset

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

Definition at line 213 of file Instructions.cs.

double ImageResizer.Instructions.Blur
getset

Guassian Blur. Requires the AdvancedFilters plugin.

Definition at line 284 of file Instructions.cs.

BoxEdges ImageResizer.Instructions.Border
getset

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

Definition at line 355 of file Instructions.cs.

string ImageResizer.Instructions.BorderColor
getset

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

Definition at line 221 of file Instructions.cs.

double ImageResizer.Instructions.Brightness
getset

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

Definition at line 260 of file Instructions.cs.

string ImageResizer.Instructions.Builder
getset

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.

Definition at line 319 of file Instructions.cs.

ServerCacheMode ImageResizer.Instructions.Cache
getset

Allows disk caching to be forced or prevented.

Definition at line 115 of file Instructions.cs.

double ImageResizer.Instructions.Contrast
getset

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

Definition at line 264 of file Instructions.cs.

double [] ImageResizer.Instructions.CropRectange
getset

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

Definition at line 167 of file Instructions.cs.

double [] ImageResizer.Instructions.CropRectangle
getset

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

Definition at line 172 of file Instructions.cs.

double ImageResizer.Instructions.CropXUnits
getset

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.

Definition at line 157 of file Instructions.cs.

double ImageResizer.Instructions.CropYUnits
getset

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.

Definition at line 161 of file Instructions.cs.

string ImageResizer.Instructions.Decoder
getset

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.

Definition at line 312 of file Instructions.cs.

string ImageResizer.Instructions.Dither
getset

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.

Definition at line 299 of file Instructions.cs.

string ImageResizer.Instructions.Encoder
getset

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.

Definition at line 306 of file Instructions.cs.

string ImageResizer.Instructions.FallbackImage
getset

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.

Definition at line 208 of file Instructions.cs.

FlipMode ImageResizer.Instructions.FinalFlip
getset

Flip instruction to perform after rendering is complete

Definition at line 105 of file Instructions.cs.

string ImageResizer.Instructions.Format
getset

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

Definition at line 192 of file Instructions.cs.

int ImageResizer.Instructions.Frame
getset

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

Definition at line 125 of file Instructions.cs.

GrayscaleMode ImageResizer.Instructions.Grayscale
getset

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

Definition at line 249 of file Instructions.cs.

int ImageResizer.Instructions.Height
getset

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

Definition at line 86 of file Instructions.cs.

bool ImageResizer.Instructions.IgnoreICC
getset

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

Definition at line 202 of file Instructions.cs.

bool ImageResizer.Instructions.Invert
getset

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

Definition at line 238 of file Instructions.cs.

int ImageResizer.Instructions.JpegQuality
getset

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

Definition at line 134 of file Instructions.cs.

JpegSubsamplingMode ImageResizer.Instructions.JpegSubsampling
getset

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

Definition at line 138 of file Instructions.cs.

BoxEdges ImageResizer.Instructions.Margin
getset

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

Definition at line 344 of file Instructions.cs.

FitMode ImageResizer.Instructions.Mode
getset

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

Definition at line 91 of file Instructions.cs.

OutputFormat ImageResizer.Instructions.OutputFormat
getset

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

Definition at line 197 of file Instructions.cs.

BoxEdges ImageResizer.Instructions.Padding
getset

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

Definition at line 333 of file Instructions.cs.

string ImageResizer.Instructions.PaddingColor
getset

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

Definition at line 217 of file Instructions.cs.

int ImageResizer.Instructions.Page
getset

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

Definition at line 129 of file Instructions.cs.

byte ImageResizer.Instructions.PaletteSize
getset

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.

Definition at line 147 of file Instructions.cs.

string ImageResizer.Instructions.Preset
getset

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.

Definition at line 226 of file Instructions.cs.

ProcessWhen ImageResizer.Instructions.Process
getset

Allows processing to be forced or prevented.

Definition at line 120 of file Instructions.cs.

double ImageResizer.Instructions.RemoveNoise
getset

Safe noise removal. Requires the AdvancedFilters plugin.

Definition at line 294 of file Instructions.cs.

double ImageResizer.Instructions.Rotate
getset

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

Definition at line 187 of file Instructions.cs.

double [] ImageResizer.Instructions.RoundCorners
getset

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.

Definition at line 325 of file Instructions.cs.

double ImageResizer.Instructions.Saturation
getset

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

Definition at line 268 of file Instructions.cs.

ScaleMode ImageResizer.Instructions.Scale
getset

Control how upscaling is performed. Defaults to DownscaleOnly.

Definition at line 110 of file Instructions.cs.

bool ImageResizer.Instructions.Sepia
getset

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

Definition at line 244 of file Instructions.cs.

double ImageResizer.Instructions.Sharpen
getset

Unsharp Mask. Requires the AdvancedFilters plugin.

Definition at line 289 of file Instructions.cs.

FlipMode ImageResizer.Instructions.SourceFlip
getset

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

Definition at line 101 of file Instructions.cs.

double ImageResizer.Instructions.SourceRotate
getset

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

Definition at line 183 of file Instructions.cs.

double ImageResizer.Instructions.TrimPadding
getset

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.

Definition at line 279 of file Instructions.cs.

byte ImageResizer.Instructions.TrimThreshold
getset

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.

Definition at line 274 of file Instructions.cs.

string ImageResizer.Instructions.Watermark
getset

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

Definition at line 231 of file Instructions.cs.

int ImageResizer.Instructions.Width
getset

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

Definition at line 82 of file Instructions.cs.

double ImageResizer.Instructions.Zoom
getset

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.

Definition at line 152 of file Instructions.cs.


The documentation for this class was generated from the following file: