C# Class NContrib.Drawing.Extensions.ImageExtensions

Afficher le fichier Open project: veracross/ncontrib

Méthodes publiques

Méthode 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

Méthode Description
SetGraphicsDefaults ( this g ) : void

Method Details

GetScaledImage() public static méthode

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
Résultat System.Drawing.Image

GetScaledImage() public static méthode

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
Résultat System.Drawing.Image

GetSquareImage() public static méthode

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

SaveJpegWithCompressionSetting() public static méthode

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
Résultat void

SaveJpegWithCompressionSetting() public static méthode

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
Résultat void