Save image into its image file
Visual Basic |
---|
Public Sub Save() |
!MISSING PHRASE '_ZONEFAIL_IMG'!
Method saves image using format specified in Format property. Some formats are "read-only" and are not supported by this method.
Some formats use lossy compression. Therefore saving image in such format will modify saved image.
Amount of JPEG compression is controlled by JpegQuality parameter.
Not each format supports all CiImage. BitsPerPixel values. Image is converted to the nearest supported BPP prior to saving.
For example Bitonal image is converted to Grayscale prior to saving using JPEG format. Resulting file image might have blocking effect, typical for JPEG lossy compression.
VB Example (Visual Basic) | Copy Code |
---|---|
Public Sub T_ImageFile(ByRef Img As CiImage, sFileName) Dim ImgZone As CiImage Dim sMulti: sMulti = "c:\tMulti.tif" Dim sZone: sZone = "c:\tZone.tif" Dim sSingle: sSingle = "c:\tSingle.tif" ' Open test Img.Open sFileName T_ImageInfo Img ' Save multi-page TIFF DeleteFile sMulti Set ImgZone = Img.CreateZone(Img.Width / 3, Img.Height / 3, _ Img.Width * 2 / 3, Img.Height * 2 / 3) Img.Append sMulti T_ImageInfo Img ImgZone.Invert: T_ImageInfo Img ImgZone.Append sMulti T_ImageInfo Img Img.Append sMulti Img.Invert Img.Append sMulti ImgZone.Append sMulti T_ImageInfo Img ' Open page Img.Open sMulti, 3 Img.Invert T_ImageInfo Img ' Save test. Save modified page to multi-page TIFF Img.Save T_ImageInfo Img ' Save as Zone Test Img.Invert ImgZone.SaveAs sZone T_ImageInfo Img ' Save as Test Img.SaveAs sSingle T_ImageInfo Img End Sub Public Sub T_ImageInfo(ByRef Img As CiImage) Debug.Print "Image #" & Img.Handle & " File='" & Img.FileName & "'" & _ " Width=" & Img.Width & " Height=" & Img.Height Debug.Print " HorzDpi=" & Img.HorzDpi & "dpi VertDpi=" & Img.VertDpi & "dpi" & _ " Page=" & Img.PageNumber & " Page Count =" & Img.PageCount & _ " Format:=" & Img.Format & _ IIf(Img.IsModified, " MODIFIED", "") End Sub |
Process Multi-page file (Visual Basic) | Copy Code |
---|---|
Public Sub T_MultiPageFile(ByRef Img As CiImage, sFileName As String) Dim nPage, nPageCount Img.Open sFileName nPageCount = Img.PageCount ' for each page For nPage = 1 To nPageCount Img.Open sFileName, nPage ' Process image page ' ==== Read barcodes ' Set BarcodePro.Image = Img ' BarcodePro.Find 0 ' ' process barcodes ' ==== Repair image ' Set Repair.Image = Img ' Repair.AutoDeskew ' Img.Append sFileOut ' save Next End Sub |
CiImage Object | CiImage Members | Open | Save | SaveAs | Append