C# Класс ImageProcessor.ImageFactory

Encapsulates methods for processing image files in a fluent manner.
Наследование: IDisposable
Показать файл Открыть проект Примеры использования класса

Private Properties

Свойство Тип Описание
ClearExif void

Открытые методы

Метод Описание
Alpha ( int percentage ) : ImageFactory

Changes the opacity of the current image.

AutoRotate ( ) : ImageFactory

Performs auto-rotation to ensure that EXIF defined rotation is reflected in the final image.

BackgroundColor ( Color color ) : ImageFactory

Changes the background color of the current image.

BitDepth ( long bitDepth ) : ImageFactory

Alters the bit depth of the current image. This can only be used to change the bit depth of images that can be saved by System.Drawing with different bit depths such as TIFF.

Brightness ( int percentage ) : ImageFactory

Changes the brightness of the current image.

Constrain ( Size size ) : ImageFactory

Constrains the current image, resizing it to fit within the given dimensions whilst keeping its aspect ratio.

Contrast ( int percentage ) : ImageFactory

Changes the contrast of the current image.

Crop ( CropLayer cropLayer ) : ImageFactory

Crops the current image to the given location and size.

Crop ( Rectangle rectangle ) : ImageFactory

Crops the current image to the given location and size.

DetectEdges ( IEdgeFilter filter, bool greyscale = true ) : ImageFactory

Detects the edges in the current image.

Dispose ( ) : void

Disposes the object and frees resources for the Garbage Collector.

EntropyCrop ( byte threshold = 128 ) : ImageFactory

Crops an image to the area of greatest entropy.

Filter ( IMatrixFilter matrixFilter ) : ImageFactory

Applies a filter to the current image. Use the MatrixFilters class to assign the correct filter.

Flip ( bool flipVertically = false, bool flipBoth = false ) : ImageFactory

Flips the current image either horizontally or vertically.

Format ( ISupportedImageFormat format ) : ImageFactory

Sets the output format of the current image to the matching T:System.Drawing.Imaging.ImageFormat.

Gamma ( float value ) : ImageFactory

Adjust the gamma (intensity of the light) component of the given image.

GaussianBlur ( GaussianLayer gaussianLayer ) : ImageFactory

Uses a Gaussian kernel to blur the current image.

GaussianBlur ( int size ) : ImageFactory

Uses a Gaussian kernel to blur the current image.

The sigma and threshold values applied to the kernel are 1.4 and 0 respectively.

GaussianSharpen ( GaussianLayer gaussianLayer ) : ImageFactory

Uses a Gaussian kernel to sharpen the current image.

GaussianSharpen ( int size ) : ImageFactory

Uses a Gaussian kernel to sharpen the current image.

The sigma and threshold values applied to the kernel are 1.4 and 0 respectively.

Halftone ( bool comicMode = false ) : ImageFactory

Converts the current image to a CMYK halftone representation of that image.

Hue ( int degrees, bool rotate = false ) : ImageFactory

Alters the hue of the current image changing the overall color.

ImageFactory ( bool preserveExifData = false ) : System

Initializes a new instance of the ImageFactory class.

ImageFactory ( bool preserveExifData, bool fixGamma ) : System

Initializes a new instance of the ImageFactory class.

Load ( Stream stream ) : ImageFactory

Loads the image to process. Always call this method first.

Load ( byte bytes ) : ImageFactory

Loads the image to process from an array of bytes. Always call this method first.

Load ( string imagePath ) : ImageFactory

Loads the image to process. Always call this method first.

Mask ( Image imageMask, Point point = null ) : ImageFactory

Applies the given image mask to the current image.

Overlay ( ImageProcessor.Imaging.ImageLayer imageLayer ) : ImageFactory

Adds a image overlay to the current image.

Pixelate ( int pixelSize, Rectangle rectangle = null ) : ImageFactory

Pixelates an image with the given size.

Quality ( int percentage ) : ImageFactory

Alters the output quality of the current image. This method will only effect the output quality of jpeg images

ReplaceColor ( Color target, Color replacement, int fuzziness ) : ImageFactory

Replaces a color within the current image.

Reset ( ) : ImageFactory

Resets the current image to its original loaded state.

Resize ( ResizeLayer resizeLayer ) : ImageFactory

Resizes the current image to the given dimensions.

Resize ( Size size ) : ImageFactory

Resizes the current image to the given dimensions.

Resolution ( int horizontal, int vertical, PropertyTagResolutionUnit unit = PropertyTagResolutionUnit.Inch ) : ImageFactory

Sets the resolution of the image. This method sets both the bitmap data and EXIF resolution if available.

Rotate ( float degrees ) : ImageFactory

Rotates the current image by the given angle.

RotateBounded ( float degrees, bool keepSize = false ) : ImageFactory

Rotates the image without expanding the canvas to fit the image.

RoundedCorners ( RoundedCornerLayer roundedCornerLayer ) : ImageFactory

Adds rounded corners to the current image.

RoundedCorners ( int radius ) : ImageFactory

Adds rounded corners to the current image.

Saturation ( int percentage ) : ImageFactory

Changes the saturation of the current image.

Save ( Stream stream ) : ImageFactory

Saves the current image to the specified output stream.

Save ( string filePath ) : ImageFactory

Saves the current image to the specified file path. If the extension does not match the correct extension for the current format it will be replaced by the correct default value.

Tint ( Color color ) : ImageFactory

Tints the current image with the given color.

Vignette ( Color color = null ) : ImageFactory

Adds a vignette image effect to the current image.

Watermark ( ImageProcessor.Imaging.TextLayer textLayer ) : ImageFactory

Adds a text based watermark to the current image.

Защищенные методы

Метод Описание
Dispose ( bool disposing ) : void

Disposes the object and frees resources for the Garbage Collector.

Приватные методы

Метод Описание
ClearExif ( Image image ) : void

Clears any EXIF metadata from the image

Описание методов

Alpha() публичный Метод

Changes the opacity of the current image.
public Alpha ( int percentage ) : ImageFactory
percentage int /// The percentage by which to alter the images opacity. /// Any integer between 0 and 100. ///
Результат ImageFactory

AutoRotate() публичный Метод

Performs auto-rotation to ensure that EXIF defined rotation is reflected in the final image.
public AutoRotate ( ) : ImageFactory
Результат ImageFactory

BackgroundColor() публичный Метод

Changes the background color of the current image.
public BackgroundColor ( Color color ) : ImageFactory
color Color /// The to paint the image with. ///
Результат ImageFactory

BitDepth() публичный Метод

Alters the bit depth of the current image. This can only be used to change the bit depth of images that can be saved by System.Drawing with different bit depths such as TIFF.
public BitDepth ( long bitDepth ) : ImageFactory
bitDepth long A value over 0.
Результат ImageFactory

Brightness() публичный Метод

Changes the brightness of the current image.
public Brightness ( int percentage ) : ImageFactory
percentage int /// The percentage by which to alter the images brightness. /// Any integer between -100 and 100. ///
Результат ImageFactory

Constrain() публичный Метод

Constrains the current image, resizing it to fit within the given dimensions whilst keeping its aspect ratio.
public Constrain ( Size size ) : ImageFactory
size System.Drawing.Size /// The containing the maximum width and height to set the image to. ///
Результат ImageFactory

Contrast() публичный Метод

Changes the contrast of the current image.
public Contrast ( int percentage ) : ImageFactory
percentage int /// The percentage by which to alter the images contrast. /// Any integer between -100 and 100. ///
Результат ImageFactory

Crop() публичный Метод

Crops the current image to the given location and size.
public Crop ( CropLayer cropLayer ) : ImageFactory
cropLayer ImageProcessor.Imaging.CropLayer /// The containing the coordinates and mode to crop the image with. ///
Результат ImageFactory

Crop() публичный Метод

Crops the current image to the given location and size.
public Crop ( Rectangle rectangle ) : ImageFactory
rectangle System.Drawing.Rectangle /// The containing the coordinates to crop the image to. ///
Результат ImageFactory

DetectEdges() публичный Метод

Detects the edges in the current image.
public DetectEdges ( IEdgeFilter filter, bool greyscale = true ) : ImageFactory
filter IEdgeFilter /// The to detect edges with. ///
greyscale bool /// Whether to convert the image to greyscale first - Defaults to true. ///
Результат ImageFactory

Dispose() публичный Метод

Disposes the object and frees resources for the Garbage Collector.
public Dispose ( ) : void
Результат void

Dispose() защищенный Метод

Disposes the object and frees resources for the Garbage Collector.
protected Dispose ( bool disposing ) : void
disposing bool If true, the object gets disposed.
Результат void

EntropyCrop() публичный Метод

Crops an image to the area of greatest entropy.
public EntropyCrop ( byte threshold = 128 ) : ImageFactory
threshold byte /// The threshold in bytes to control the entropy. ///
Результат ImageFactory

Filter() публичный Метод

Applies a filter to the current image. Use the MatrixFilters class to assign the correct filter.
public Filter ( IMatrixFilter matrixFilter ) : ImageFactory
matrixFilter IMatrixFilter /// The of the filter to add to the image. ///
Результат ImageFactory

Flip() публичный Метод

Flips the current image either horizontally or vertically.
public Flip ( bool flipVertically = false, bool flipBoth = false ) : ImageFactory
flipVertically bool /// Whether to flip the image vertically. ///
flipBoth bool /// Whether to flip the image both vertically and horizontally. ///
Результат ImageFactory

Format() публичный Метод

Sets the output format of the current image to the matching T:System.Drawing.Imaging.ImageFormat.
public Format ( ISupportedImageFormat format ) : ImageFactory
format ISupportedImageFormat The . to set the image to.
Результат ImageFactory

Gamma() публичный Метод

Adjust the gamma (intensity of the light) component of the given image.
public Gamma ( float value ) : ImageFactory
value float /// The value to adjust the gamma by (typically between .2 and 5). ///
Результат ImageFactory

GaussianBlur() публичный Метод

Uses a Gaussian kernel to blur the current image.
public GaussianBlur ( GaussianLayer gaussianLayer ) : ImageFactory
gaussianLayer ImageProcessor.Imaging.GaussianLayer /// The for applying sharpening and /// blurring methods to an image. ///
Результат ImageFactory

GaussianBlur() публичный Метод

Uses a Gaussian kernel to blur the current image.

The sigma and threshold values applied to the kernel are 1.4 and 0 respectively.

public GaussianBlur ( int size ) : ImageFactory
size int /// The size to set the Gaussian kernel to. ///
Результат ImageFactory

GaussianSharpen() публичный Метод

Uses a Gaussian kernel to sharpen the current image.
public GaussianSharpen ( GaussianLayer gaussianLayer ) : ImageFactory
gaussianLayer ImageProcessor.Imaging.GaussianLayer /// The for applying sharpening and /// blurring methods to an image. ///
Результат ImageFactory

GaussianSharpen() публичный Метод

Uses a Gaussian kernel to sharpen the current image.

The sigma and threshold values applied to the kernel are 1.4 and 0 respectively.

public GaussianSharpen ( int size ) : ImageFactory
size int /// The size to set the Gaussian kernel to. ///
Результат ImageFactory

Halftone() публичный Метод

Converts the current image to a CMYK halftone representation of that image.
public Halftone ( bool comicMode = false ) : ImageFactory
comicMode bool /// Whether to trace over the current image and add borders to add a comic book effect. ///
Результат ImageFactory

Hue() публичный Метод

Alters the hue of the current image changing the overall color.
public Hue ( int degrees, bool rotate = false ) : ImageFactory
degrees int /// The angle by which to alter the images hue. /// Any integer between 0 and 360. ///
rotate bool /// Whether to rotate the hue of the current image altering each color ///
Результат ImageFactory

ImageFactory() публичный Метод

Initializes a new instance of the ImageFactory class.
public ImageFactory ( bool preserveExifData = false ) : System
preserveExifData bool /// Whether to preserve exif metadata. Defaults to false. ///
Результат System

ImageFactory() публичный Метод

Initializes a new instance of the ImageFactory class.
public ImageFactory ( bool preserveExifData, bool fixGamma ) : System
preserveExifData bool /// Whether to preserve exif metadata. Defaults to false. ///
fixGamma bool /// Whether to fix the gamma component of the image. Defaults to true. ///
Результат System

Load() публичный Метод

Loads the image to process. Always call this method first.
public Load ( Stream stream ) : ImageFactory
stream Stream /// The containing the image information. ///
Результат ImageFactory

Load() публичный Метод

Loads the image to process from an array of bytes. Always call this method first.
public Load ( byte bytes ) : ImageFactory
bytes byte /// The containing the image information. ///
Результат ImageFactory

Load() публичный Метод

Loads the image to process. Always call this method first.
public Load ( string imagePath ) : ImageFactory
imagePath string The absolute path to the image to load.
Результат ImageFactory

Mask() публичный Метод

Applies the given image mask to the current image.
public Mask ( Image imageMask, Point point = null ) : ImageFactory
imageMask Image /// The image containing the mask to apply. ///
point Point /// The to place the mask if it not the same dimensions as the original image. /// If no position is set, the mask will be centered within the image. ///
Результат ImageFactory

Overlay() публичный Метод

Adds a image overlay to the current image.
public Overlay ( ImageProcessor.Imaging.ImageLayer imageLayer ) : ImageFactory
imageLayer ImageProcessor.Imaging.ImageLayer /// The containing the properties necessary to add /// the image overlay to the image. ///
Результат ImageFactory

Pixelate() публичный Метод

Pixelates an image with the given size.
public Pixelate ( int pixelSize, Rectangle rectangle = null ) : ImageFactory
pixelSize int /// The size of the pixels to create.
rectangle System.Drawing.Rectangle /// The area in which to pixelate the image. If not set, the whole image is pixelated. ///
Результат ImageFactory

Quality() публичный Метод

Alters the output quality of the current image. This method will only effect the output quality of jpeg images
public Quality ( int percentage ) : ImageFactory
percentage int A value between 1 and 100 to set the quality to.
Результат ImageFactory

ReplaceColor() публичный Метод

Replaces a color within the current image.
public ReplaceColor ( Color target, Color replacement, int fuzziness ) : ImageFactory
target Color /// The target . ///
replacement Color /// The replacement . ///
fuzziness int /// A value between 0 and 128 with which to alter the target detection accuracy. ///
Результат ImageFactory

Reset() публичный Метод

Resets the current image to its original loaded state.
public Reset ( ) : ImageFactory
Результат ImageFactory

Resize() публичный Метод

Resizes the current image to the given dimensions.
public Resize ( ResizeLayer resizeLayer ) : ImageFactory
resizeLayer ImageProcessor.Imaging.ResizeLayer /// The containing the properties required to resize the image. ///
Результат ImageFactory

Resize() публичный Метод

Resizes the current image to the given dimensions.
public Resize ( Size size ) : ImageFactory
size System.Drawing.Size /// The containing the width and height to set the image to. ///
Результат ImageFactory

Resolution() публичный Метод

Sets the resolution of the image. This method sets both the bitmap data and EXIF resolution if available.
public Resolution ( int horizontal, int vertical, PropertyTagResolutionUnit unit = PropertyTagResolutionUnit.Inch ) : ImageFactory
horizontal int The horizontal resolution.
vertical int The vertical resolution.
unit PropertyTagResolutionUnit /// The unit of measure for the horizontal resolution and the vertical resolution. /// Defaults to inches ///
Результат ImageFactory

Rotate() публичный Метод

Rotates the current image by the given angle.
public Rotate ( float degrees ) : ImageFactory
degrees float /// The angle at which to rotate the image in degrees. ///
Результат ImageFactory

RotateBounded() публичный Метод

Rotates the image without expanding the canvas to fit the image.
public RotateBounded ( float degrees, bool keepSize = false ) : ImageFactory
degrees float /// The angle at which to rotate the image in degrees. ///
keepSize bool /// Whether to keep the original image dimensions. /// /// If set to true, the image is zoomed to fit the bounding area. /// /// /// If set to false, the area is cropped to fit the rotated image. /// ///
Результат ImageFactory

RoundedCorners() публичный Метод

Adds rounded corners to the current image.
public RoundedCorners ( RoundedCornerLayer roundedCornerLayer ) : ImageFactory
roundedCornerLayer ImageProcessor.Imaging.RoundedCornerLayer /// The containing the properties to round corners on the image. ///
Результат ImageFactory

RoundedCorners() публичный Метод

Adds rounded corners to the current image.
public RoundedCorners ( int radius ) : ImageFactory
radius int /// The radius at which the corner will be rounded. ///
Результат ImageFactory

Saturation() публичный Метод

Changes the saturation of the current image.
public Saturation ( int percentage ) : ImageFactory
percentage int /// The percentage by which to alter the images saturation. /// Any integer between -100 and 100. ///
Результат ImageFactory

Save() публичный Метод

Saves the current image to the specified output stream.
public Save ( Stream stream ) : ImageFactory
stream Stream /// The to save the image information to. ///
Результат ImageFactory

Save() публичный Метод

Saves the current image to the specified file path. If the extension does not match the correct extension for the current format it will be replaced by the correct default value.
public Save ( string filePath ) : ImageFactory
filePath string The path to save the image to.
Результат ImageFactory

Tint() публичный Метод

Tints the current image with the given color.
public Tint ( Color color ) : ImageFactory
color Color /// The to tint the image with. ///
Результат ImageFactory

Vignette() публичный Метод

Adds a vignette image effect to the current image.
public Vignette ( Color color = null ) : ImageFactory
color Color /// The to tint the image with. Defaults to black. ///
Результат ImageFactory

Watermark() публичный Метод

Adds a text based watermark to the current image.
public Watermark ( ImageProcessor.Imaging.TextLayer textLayer ) : ImageFactory
textLayer ImageProcessor.Imaging.TextLayer /// The containing the properties necessary to add /// the text based watermark to the image. ///
Результат ImageFactory