Leadtools.CF Send comments on this topic. | Back to Introduction - All Topics | Help Version 17.0.6.15
Convert Method
See Also 
Leadtools.Codecs Namespace > RasterCodecs Class : Convert Method



srcFileName
The input file name.
destFileName
The output file name. If the file exists, it will be overwritten. Not that the folder where destFileName to be created must exist prior of calling this method.
format
An RasterImageFormat that specifies the output file format.
width
The new width of the output file. 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
The new height of the output file. 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 object specifying more options for the conversion. If nothing is known about the file, pass null (Nothing in Visual Basic) for this parameter. However, if you obtained information about srcFileName through RasterCodecs.GetInformation, then you can pass the CodecsImageInfo returned from that method to the info parameter to speed up the conversion process.
srcFileName
The input file name.
destFileName
The output file name. If the file exists, it will be overwritten. Not that the folder where destFileName to be created must exist prior of calling this method.
format
An RasterImageFormat that specifies the output file format.
width
The new width of the output file. 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
The new height of the output file. 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 object specifying more options for the conversion. If nothing is known about the file, pass null (Nothing in Visual Basic) for this parameter. However, if you obtained information about srcFileName through RasterCodecs.GetInformation, then you can pass the CodecsImageInfo returned from that method to the info parameter to speed up the conversion process.
Converts an image file from one format to another, creating a new file in the new format.

Syntax

Visual Basic (Declaration) 
Public Sub Convert( _
   ByVal srcFileName As String, _
   ByVal destFileName As String, _
   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 srcFileName As String
Dim destFileName As String
Dim format As RasterImageFormat
Dim width As Integer
Dim height As Integer
Dim bitsPerPixel As Integer
Dim info As CodecsImageInfo
 
instance.Convert(srcFileName, destFileName, format, width, height, bitsPerPixel, info)
C# 
public void Convert( 
   string srcFileName,
   string destFileName,
   RasterImageFormat format,
   int width,
   int height,
   int bitsPerPixel,
   CodecsImageInfo info
)
C++/CLI 
public:
void Convert( 
   String^ srcFileName,
   String^ destFileName,
   RasterImageFormat format,
   int width,
   int height,
   int bitsPerPixel,
   CodecsImageInfo^ info
) 

Parameters

srcFileName
The input file name.
destFileName
The output file name. If the file exists, it will be overwritten. Not that the folder where destFileName to be created must exist prior of calling this method.
format
An RasterImageFormat that specifies the output file format.
width
The new width of the output file. 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
The new height of the output file. 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 object specifying more options for the conversion. If nothing is known about the file, pass null (Nothing in Visual Basic) for this parameter. However, if you obtained information about srcFileName through RasterCodecs.GetInformation, then you can pass the CodecsImageInfo returned from that method to the info parameter to speed up the conversion process.

Example

This example will convert all the images in the source folder to JPEG images and put them in the destination folder.

Requirements

Target Platforms: Microsoft .NET CF Framework 2.0, Windows Mobile 5 PocketPC, Windows Mobile 5 Smartphone, Windows Mobile 6

See Also