LEADTOOLS Image File Support (Leadtools.Codecs assembly) Send comments on this topic. | Back to Introduction - All Topics | Help Version 17.0.3.29
Convert(Stream,Stream,RasterImageFormat,Int32,Int32,Int32,CodecsImageInfo) Method
See Also 
Leadtools.Codecs Namespace > RasterCodecs Class > Convert Method : Convert(Stream,Stream,RasterImageFormat,Int32,Int32,Int32,CodecsImageInfo) Method



srcStream
A System.IO.Stream containing the data of the input image file.
destStream
A System.IO.Stream that will contain the data of the output image file.
format
The output file format. For valid values, refer to Summary of All Supported Image File Formats.
width
New width of the output image. If this value is not 0, then the output file will be resized to the width value. Use a value of 0 if you do not wish to resize the output file.
height
New height of the output image. If this value is not 0, then the output file will be resized to the height value. Use a value of 0 if you do not wish to resize the output file.
bitsPerPixel
The output image pixel depth. Note that not all bits per pixel are available to all file formats.
info
A CodecsImageInfo obect specifying more options for the conversion.
srcStream
A System.IO.Stream containing the data of the input image file.
destStream
A System.IO.Stream that will contain the data of the output image file.
format
The output file format. For valid values, refer to Summary of All Supported Image File Formats.
width
New width of the output image. If this value is not 0, then the output file will be resized to the width value. Use a value of 0 if you do not wish to resize the output file.
height
New height of the output image. If this value is not 0, then the output file will be resized to the height value. Use a value of 0 if you do not wish to resize the output file.
bitsPerPixel
The output image pixel depth. Note that not all bits per pixel are available to all file formats.
info
A CodecsImageInfo obect specifying more options for the conversion.
Converts an image stream from one format to another, creating a new image file in a stream in the new format.

Syntax

Visual Basic (Declaration) 
Overloads Public Sub Convert( _
   ByVal srcStream As Stream, _
   ByVal destStream As Stream, _
   ByVal format As RasterImageFormat, _
   ByVal width As Integer, _
   ByVal height As Integer, _
   ByVal bitsPerPixel As Integer, _
   ByVal info As CodecsImageInfo _
) 
Visual Basic (Usage)Copy Code
Dim instance As RasterCodecs
Dim srcStream As Stream
Dim destStream As Stream
Dim format As RasterImageFormat
Dim width As Integer
Dim height As Integer
Dim bitsPerPixel As Integer
Dim info As CodecsImageInfo
 
instance.Convert(srcStream, destStream, format, width, height, bitsPerPixel, info)
C# 
public void Convert( 
   Stream srcStream,
   Stream destStream,
   RasterImageFormat format,
   int width,
   int height,
   int bitsPerPixel,
   CodecsImageInfo info
)
C++/CLI 
public:
void Convert( 
   Stream^ srcStream,
   Stream^ destStream,
   RasterImageFormat format,
   int width,
   int height,
   int bitsPerPixel,
   CodecsImageInfo^ info
) 

Parameters

srcStream
A System.IO.Stream containing the data of the input image file.
destStream
A System.IO.Stream that will contain the data of the output image file.
format
The output file format. For valid values, refer to Summary of All Supported Image File Formats.
width
New width of the output image. If this value is not 0, then the output file will be resized to the width value. Use a value of 0 if you do not wish to resize the output file.
height
New height of the output image. If this value is not 0, then the output file will be resized to the height value. Use a value of 0 if you do not wish to resize the output file.
bitsPerPixel
The output image pixel depth. Note that not all bits per pixel are available to all file formats.
info
A CodecsImageInfo obect specifying more options for the conversion.

Example

For an example, refer to Convert.

Remarks

If you convert to a lower bits-per-pixel format, this method optimizes the colors automatically. For example, when converting a 24-bit file (16 million colors) to an 8-bit file (256 colors) this method selects the best 256 colors to represent the 24-bit image

Note that this is a high-level method that does conversion from all possible formats to all possible formats.

Requirements

Target Platforms: Silverlight, Windows XP, Windows Server 2003 family, Windows Server 2008 family, Windows Vista, Windows 7, MAC OS/X (Intel Only)

See Also