Leadtools.Mrc Namespace > MrcSegmenter Class : SaveImage Method |
public void SaveImage( RasterImage image, string fileName, MrcImageFormat format, MrcCompressionOptions options, RasterCodecs codecs )
'Declaration Public Sub SaveImage( _ ByVal image As RasterImage, _ ByVal fileName As String, _ ByVal format As MrcImageFormat, _ ByVal options As MrcCompressionOptions, _ ByVal codecs As RasterCodecs _ )
'Usage Dim instance As MrcSegmenter Dim image As RasterImage Dim fileName As String Dim format As MrcImageFormat Dim options As MrcCompressionOptions Dim codecs As RasterCodecs instance.SaveImage(image, fileName, format, options, codecs)
public void SaveImage( RasterImage image, string fileName, MrcImageFormat format, MrcCompressionOptions options, RasterCodecs codecs )
public: void SaveImage( RasterImage^ image, String^ fileName, MrcImageFormat format, MrcCompressionOptions options, RasterCodecs^ codecs )
Public Sub SaveImageExample() ' Load an image Dim codecs As RasterCodecs = New RasterCodecs() codecs.ThrowExceptionsOnInvalidImages = True Dim image As RasterImage = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "MRCSegmentation.mrc")) Dim segmenter As MrcSegmenter = New MrcSegmenter(image, Path.Combine(LEAD_VARS.ImagesDir, "MRCSegmentation.sgm")) Dim compressionOptions As MrcCompressionOptions = MrcCompressionOptions.Empty compressionOptions.MaskCoder = MrcMaskCompression.FaxG31D compressionOptions.PictureCoder = MrcPictureCompression.Jpeg compressionOptions.PictureQualityFactor = 10 compressionOptions.Grayscale8BitCoder = MrcGrayscaleCompression8BitCoder.GrayscaleCmw compressionOptions.Grayscale8BitFactor = 2 compressionOptions.Grayscale2BitCoder = MrcGrayscaleCompression2BitCoder.Jbig2 compressionOptions.Text2BitCoder = MrcTextCompression2BitCoder.Jbig2Bit Try segmenter.SaveImage(image, Path.Combine(LEAD_VARS.ImagesDir, "Result.Mrc"), MrcImageFormat.Mrc, compressionOptions, codecs) Catch e As Exception MessageBox.Show(e.Message) End Try End Sub Public NotInheritable Class LEAD_VARS Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images" End Class
public void SaveImageExample() { // Load an image RasterCodecs codecs = new RasterCodecs(); codecs.ThrowExceptionsOnInvalidImages = true; RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir,"MRCSegmentation.mrc")); MrcSegmenter segmenter = new MrcSegmenter(image,Path.Combine(LEAD_VARS.ImagesDir, "MRCSegmentation.sgm")); MrcCompressionOptions compressionOptions = MrcCompressionOptions.Empty; compressionOptions.MaskCoder = MrcMaskCompression.FaxG31D; compressionOptions.PictureCoder = MrcPictureCompression.Jpeg; compressionOptions.PictureQualityFactor = 10; compressionOptions.Grayscale8BitCoder = MrcGrayscaleCompression8BitCoder.GrayscaleCmw ; compressionOptions.Grayscale8BitFactor = 2; compressionOptions.Grayscale2BitCoder = MrcGrayscaleCompression2BitCoder.Jbig2; compressionOptions.Text2BitCoder = MrcTextCompression2BitCoder.Jbig2Bit; try { segmenter.SaveImage(image,Path.Combine(LEAD_VARS.ImagesDir,"Out_Result.Mrc"), MrcImageFormat.Mrc, compressionOptions, codecs); } catch(Exception e) { MessageBox.Show(e.Message); } } static class LEAD_VARS { public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images"; }
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2