Leadtools.Windows.Controls.Pro Send comments on this topic. | Back to Introduction - All Topics | Help Version 15.03.25
Save(String,RasterImageFormat,Int32,Int32) Method
See Also  Example
Leadtools.Windows.Controls Namespace > RasterImageViewer Class > Save Method : Save(String,RasterImageFormat,Int32,Int32) Method




fileName
A String containing the output file name.
format
The output file format. For valid values, refer to Summary of All Supported Image File Formats.
bitsPerPixel
Resulting file's pixel depth. Note that not all bits per pixel are available to all file formats. For valid values, refer to Summary of All Supported Image File Formats. If bitsPerPixel is 0, the image will be stored using the closest bits per pixel value supported by that format. For example, if a file format supports 1, 4, and 24 bits per pixel, and RasterImage.BitsPerPixel is 5, the file will be stored as a 24-bit image. Likewise, if RasterImage.BitsPerPixel is 2, the file will be stored as a 4-bit image.
qualityFactor
A quality factor to be used when saving the RasterImageViewer.Image to a file.
Saves a Image to a file in any of the supported compressed or uncompressed formats.

Syntax

Visual Basic (Declaration) 
Overloads Public Sub Save( _
   ByVal fileName As String, _
   ByVal format As RasterImageFormat, _
   ByVal bitsPerPixel As Integer, _
   ByVal qualityFactor As Integer _
) 
Visual Basic (Usage)Copy Code
Dim instance As RasterImageViewer
Dim fileName As String
Dim format As RasterImageFormat
Dim bitsPerPixel As Integer
Dim qualityFactor As Integer
 
instance.Save(fileName, format, bitsPerPixel, qualityFactor)
C# 
public void Save( 
   string fileName,
   RasterImageFormat format,
   int bitsPerPixel,
   int qualityFactor
)
Managed Extensions for C++ 
public: void Save( 
   string* fileName,
   RasterImageFormat format,
   int bitsPerPixel,
   int qualityFactor
) 
C++/CLI 
public:
void Save( 
   String^ fileName,
   RasterImageFormat format,
   int bitsPerPixel,
   int qualityFactor
) 

Parameters

fileName
A String containing the output file name.
format
The output file format. For valid values, refer to Summary of All Supported Image File Formats.
bitsPerPixel
Resulting file's pixel depth. Note that not all bits per pixel are available to all file formats. For valid values, refer to Summary of All Supported Image File Formats. If bitsPerPixel is 0, the image will be stored using the closest bits per pixel value supported by that format. For example, if a file format supports 1, 4, and 24 bits per pixel, and RasterImage.BitsPerPixel is 5, the file will be stored as a 24-bit image. Likewise, if RasterImage.BitsPerPixel is 2, the file will be stored as a 4-bit image.
qualityFactor
A quality factor to be used when saving the RasterImageViewer.Image to a file.

Example

This example will load a 24 bits per pixel CMP image and save it as 1 bits per pixel TIF image.

Visual BasicCopy Code
Public Sub RasterImageViewer_Save2(ByVal viewer As RasterImageViewer)
   Dim srcFileName As String = "C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\Image1.cmp"
   Dim destFileName As String = "C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\Image1_SaveFile1.tif"

      ' Load the source file (make sure to load it as 24 bits per pixel)
   viewer.Load(srcFileName, 0, CodecsLoadByteOrder.Bgr, 1)
   Console.WriteLine("Loaded image has {0} bpp", viewer.Image.BitsPerPixel)

   ' Save it as 1 bpp TIF
   viewer.Save(destFileName, RasterImageFormat.Tif, 1, 128)
End Sub
C#Copy Code
public void RasterImageViewer_Save2(RasterImageViewer viewer) 

   string srcFileName = @"C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\Image1.cmp"; 
   string destFileName = @"C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\Image1_SaveFile1.tif"; 
 
   // Load the source file (make sure to load as 24 bits/pixel) 
   viewer.Load(srcFileName, 0, CodecsLoadByteOrder.Bgr,1); 
   Console.WriteLine("Loaded image has {0} bpp", viewer.Image.BitsPerPixel); 
 
   // Save it as 1 bpp TIF 
   viewer.Save(destFileName, RasterImageFormat.Tif, 1, 128); 
}

Remarks

You can set the qualityFactor parameter to a value from 2 to 255 when saving JPEG and LEAD CMP compressed images, where 2 represents the highest quality and 255 the most compression.

If the image is 8 bits per pixel or greater, use the LEAD CMP format or one of the JPEG (JTIF or JFIF) formats to save disk space.

If the image is 1-bit per pixel, use the LEAD 1-bit format or a CCITT Group 3 or 4 format to save disk space.

Requirements

Target Platforms: Microsoft .NET Framework 3.0, Windows XP, Windows Vista, and Windows Server 2003 family

See Also

Leadtools.Windows.Controls.Pro.dxp requires a WFP Module license and unlock key. For more information, refer to: Raster Pro/Document/Medical Features and Unlocking Special LEAD Features.