C# Class NContrib.Drawing.Extensions.ImageExtensions

Mostrar archivo Open project: veracross/ncontrib

Public Methods

Method Description
GetScaledImage ( this source, Size size ) : Image

Scales an image to within the specified dimensions, disregarding aspect ratio. To preserve aspect ratio, generate the size parameter using the Constrain, Scale, and Expand methods

GetScaledImage ( this source, int width, int height ) : Image

Scales an image to within the specified dimensions, disregarding aspect ratio

GetSquareImage ( this image ) : Image

Crops an image to make it square

SaveJpegWithCompressionSetting ( this img, Stream outputStream, long compression ) : void

Saves an Image as a JPEG to the given stream using a 1 - 100 compression level

SaveJpegWithCompressionSetting ( this img, string fileName, int compression ) : void

Saves an Image as a JPEG image to the given path using a 1 - 100 compression level

Private Methods

Method Description
SetGraphicsDefaults ( this g ) : void

Method Details

GetScaledImage() public static method

Scales an image to within the specified dimensions, disregarding aspect ratio. To preserve aspect ratio, generate the size parameter using the Constrain, Scale, and Expand methods
public static GetScaledImage ( this source, Size size ) : Image
source this
size System.Drawing.Size New size to scale to. Consider using the Constrain, Scale, and Expand methods to generate this value
return System.Drawing.Image

GetScaledImage() public static method

Scales an image to within the specified dimensions, disregarding aspect ratio
public static GetScaledImage ( this source, int width, int height ) : Image
source this
width int
height int
return System.Drawing.Image

GetSquareImage() public static method

Crops an image to make it square
public static GetSquareImage ( this image ) : Image
image this
return System.Drawing.Image

SaveJpegWithCompressionSetting() public static method

Saves an Image as a JPEG to the given stream using a 1 - 100 compression level
public static SaveJpegWithCompressionSetting ( this img, Stream outputStream, long compression ) : void
img this
outputStream System.IO.Stream
compression long
return void

SaveJpegWithCompressionSetting() public static method

Saves an Image as a JPEG image to the given path using a 1 - 100 compression level
public static SaveJpegWithCompressionSetting ( this img, string fileName, int compression ) : void
img this
fileName string
compression int
return void