C# Class NContrib.Drawing.ImageTypeHelper

Mostra file Open project: veracross/ncontrib Class Usage Examples

Public Methods

Method Description
GetImageEncoderFromMimeType ( string mimeType ) : System.Drawing.Imaging.ImageCodecInfo

Gets the appropriate ImageCodecInfo based on a mime type

GetImageFormatFromMimeType ( string mimeType ) : ImageFormat

Get the appropriate ImageFormat for the specified mimeType using GetImageEncoderFromMimeType as a helper.

IsBmp ( Stream stream ) : bool

Looks for the BMP 2-byte leading signature at the current position in the stream. Rewinds the stream to its original position when finished.

IsGif ( Stream stream ) : bool

Looks for the GIF 6-byte leading signature and version the current position in the stream. Rewinds the stream to its original position when finished.

IsImageType ( Stream stream, ImageFormat type ) : bool

Detects if the image in the given stream is

IsJpeg ( Stream stream ) : bool

Looks for the JPEG 2-bytes leading signature at the current position in the stream Rewinds the stream to its original position when finished.

IsPng ( Stream stream ) : bool

Looks for the PNG 8-byte leading signature at the current position in the stream. Rewinds the stream to its original position when finished.

Method Details

GetImageEncoderFromMimeType() public static method

Gets the appropriate ImageCodecInfo based on a mime type
public static GetImageEncoderFromMimeType ( string mimeType ) : System.Drawing.Imaging.ImageCodecInfo
mimeType string
return System.Drawing.Imaging.ImageCodecInfo

GetImageFormatFromMimeType() public static method

Get the appropriate ImageFormat for the specified mimeType using GetImageEncoderFromMimeType as a helper.
public static GetImageFormatFromMimeType ( string mimeType ) : ImageFormat
mimeType string
return System.Drawing.Imaging.ImageFormat

IsBmp() public static method

Looks for the BMP 2-byte leading signature at the current position in the stream. Rewinds the stream to its original position when finished.
public static IsBmp ( Stream stream ) : bool
stream Stream
return bool

IsGif() public static method

Looks for the GIF 6-byte leading signature and version the current position in the stream. Rewinds the stream to its original position when finished.
public static IsGif ( Stream stream ) : bool
stream Stream
return bool

IsImageType() public static method

Detects if the image in the given stream is
public static IsImageType ( Stream stream, ImageFormat type ) : bool
stream Stream
type System.Drawing.Imaging.ImageFormat
return bool

IsJpeg() public static method

Looks for the JPEG 2-bytes leading signature at the current position in the stream Rewinds the stream to its original position when finished.
public static IsJpeg ( Stream stream ) : bool
stream Stream
return bool

IsPng() public static method

Looks for the PNG 8-byte leading signature at the current position in the stream. Rewinds the stream to its original position when finished.
public static IsPng ( Stream stream ) : bool
stream Stream
return bool