C# Class Framework.Core.Helpers.Images.DefaultImageUtility

Default IImageUtility implementation. Using GDI+ to process images.
Inheritance: IImageUtility
Show file Open project: coreframework/Core-Framework

Public Methods

Method Description
AddWatermark ( String source, String watermark, String destination ) : void

Adds a watermark to source.

ResizeImage ( Image source, String resized, int width, int height ) : void

Resizes the image.

If any of passed width or height is equal to 0 then parameter is excluded from calculations. If both parameters are equal to 0 then original image will serve as thumbnail. The result thumbnail will not be wider than width and will not be higher than height.

ResizeImage ( Stream source, String resized, int width, int height ) : void

Resizes the image.

If any of passed width or height is equal to 0 then parameter is excluded from calculations. If both parameters are equal to 0 then original image will serve as thumbnail. The result thumbnail will not be wider than width and will not be higher than height.

ResizeImage ( String source, String resized, int width, int height ) : void

Resizes the image.

If any of passed width or height is equal to 0 then parameter is excluded from calculations. If both parameters are equal to 0 then original image will serve as thumbnail. The result thumbnail will not be wider than width and will not be higher than height.

Private Methods

Method Description
GetEncoderInfo ( String mimeType ) : System.Drawing.Imaging.ImageCodecInfo
GetMimeType ( String fileName ) : String
SaveImage ( Bitmap image, String targetFile ) : void

Method Details

AddWatermark() public method

Adds a watermark to source.
public AddWatermark ( String source, String watermark, String destination ) : void
source String The source file.
watermark String The watermark file.
destination String The destination file.
return void

ResizeImage() public method

Resizes the image.
If any of passed width or height is equal to 0 then parameter is excluded from calculations. If both parameters are equal to 0 then original image will serve as thumbnail. The result thumbnail will not be wider than width and will not be higher than height.
public ResizeImage ( Image source, String resized, int width, int height ) : void
source Image The input image.
resized String Target resized file path.
width int Width of the target.
height int Height of the target.
return void

ResizeImage() public method

Resizes the image.
If any of passed width or height is equal to 0 then parameter is excluded from calculations. If both parameters are equal to 0 then original image will serve as thumbnail. The result thumbnail will not be wider than width and will not be higher than height.
public ResizeImage ( Stream source, String resized, int width, int height ) : void
source Stream The input stream.
resized String Target resized file path.
width int Width of the target.
height int Height of the target.
return void

ResizeImage() public method

Resizes the image.
If any of passed width or height is equal to 0 then parameter is excluded from calculations. If both parameters are equal to 0 then original image will serve as thumbnail. The result thumbnail will not be wider than width and will not be higher than height.
public ResizeImage ( String source, String resized, int width, int height ) : void
source String Name of the source file.
resized String Name of the target file.
width int Width of the target. If it is equal to 0 then it will not be included into calculations.
height int Height of the target. If it is equal to 0 then it will not be included into calculations.
return void