ClearImage .NET API
Save Method (CiImage)
Example 





Inlite.ClearImage Namespace > CiImage Class : Save Method
Save image into its image file
Syntax
'Declaration
 
Public Function Save() As System.Integer
'Usage
 
Dim instance As CiImage
Dim value As System.Integer
 
value = instance.Save()
public System.int Save()
public function Save(): System.Integer; 
public function Save() : System.int;
public:
System.int Save(); 
Remarks

This method saves an image using FileName and Format properties.   Image compression of TIFF and PDF files is controlled by pComprBitonal and pComprColorExJpegQuality property controls compression when pComprColor=citcJPEG or file format is JPEG.

See Image file saving guidelines on Inlite's How-to Web Site

This method generates an error if object.Image.IsZone is true.

Example
Open, Save, Append Image. List image properties
void OpenSaveAppendImages(string imageFile1, string imageFile2, string pdfFileOut)
{
    CiServer ci = Inlite.ClearImageNet.Server.GetThreadServer();
    CiImage Image = ci.CreateImage();
    // Create PDF file with image from the first file
    Image.Open(imageFile1, 1);
    Image.SaveAs(pdfFileOut, EFileFormat.cifPDF);
    // Append to PDF file image from the second file
    Image.Open(imageFile2, 1);
    Image.Append(pdfFileOut, EFileFormat.cifPDF);
    // Open PDF page and show image information
    Image.Open(pdfFileOut, 2);
    ShowImageInfo(Image);
    // Close image
    Image.Close();
}

void ShowImageInfo(CiImage Image)
{
    Console.WriteLine("  File='" + Image.FileName + "'" + " Page=" + Image.PageNumber + " PageCount=" + Image.PageCount + "  Format=" + Image.Format);
    Console.WriteLine("  Width=" + Image.Width + "  Height=" + Image.Height + "  BPP=" + Image.BitsPerPixel + " HorzDpi=" + Image.HorzDpi + "   VertDpi=" + Image.VertDpi);
}
Sub OpenSaveAppendImages(imageFile1 As String, imageFile2 As String, pdfFileOut As String)
    Dim ci As CiServer = Inlite.ClearImageNet.Server.GetThreadServer()
    Dim Image As CiImage = ci.CreateImage()
    ' Create PDF file with image from the first file
    Image.Open(imageFile1, 1)
    Image.SaveAs(pdfFileOut, EFileFormat.cifPDF)
    ' Append to PDF file image from the second file
    Image.Open(imageFile2, 1)
    Image.Append(pdfFileOut, EFileFormat.cifPDF)
    '  Open PDF page and show image information
    Image.Open(pdfFileOut, 2)
    ShowImageInfo(Image)
    '  Close image
    Image.Close()
End Sub

Sub ShowImageInfo(Image As CiImage)
    Console.WriteLine("  File='" + Image.FileName + "'" + " Page=" + Image.PageNumber + " PageCount=" + Image.PageCount + "  Format=" + Image.Format)
    Console.WriteLine("  Width=" + Image.Width + "  Height=" + Image.Height + "  BPP=" + Image.BitsPerPixel + " HorzDpi=" + Image.HorzDpi + "   VertDpi=" + Image.VertDpi)
End Sub
Process multi-page file
void ProcessMultiPageFile(string imageFile)
{
    CiServer ci = Inlite.ClearImageNet.Server.GetThreadServer();
    CiImage Image = ci.CreateImage();
    Image.Open(imageFile, 1);
    for (int page = 1; page <= Image.PageCount; page++)
    {
        Image.Open(imageFile, page);
        //  Process  image page, for example
        //  ==== Read barcodes
        //     BarcodePro.Image = Image;
        //     BarcodePro.Find(0);
        //     // process barcodes
        //  ==== Repair image
        //     Repair.Image = Image;
        //     Repair.AutoDeskew();
        //     Image.Append (pdfFileOut, EFileFormat.cifPDF);
    }
 }
Sub ProcessMultiPageFile(imageFile As String)
    Dim ci As CiServer = Inlite.ClearImageNet.Server.GetThreadServer()
    Dim Image As CiImage = ci.CreateImage()
    Dim page As Integer
    Image.Open(imageFile, 1)
    For page = 1 To Image.PageCount
        Image.Open(imageFile, page)
        '  Process  image page, for example
        '  ==== Read barcodes
        '     BarcodePro.Image = Image
        '     BarcodePro.Find(0)
        '     ' process barcodes
        '  ==== Repair image
        '     Repair.Image = Image
        '     Repair.AutoDeskew()
        '     Image.Append (pdfFileOut, EFileFormat.cifPDF)
    Next
End Sub
See Also

Reference

CiImage Class
CiImage Members
CiPdf Class
Append Method
Open Method
Save Method
SaveAs Method