Grayscale2BitCoder Property

Summary
Gets or sets a value that indicates the background (grayscale 2 bit) compression type.
Syntax
C#
C++/CLI
Python
public MrcGrayscaleCompression2BitCoder Grayscale2BitCoder { get; set; } 
public: 
property MrcGrayscaleCompression2BitCoder Grayscale2BitCoder { 
   MrcGrayscaleCompression2BitCoder get(); 
   void set (    MrcGrayscaleCompression2BitCoder ); 
} 
Grayscale2BitCoder # get and set (MrcCompressionOptions) 

Property Value

All possible values are found in MrcGrayscaleCompression2BitCoder.

Remarks

This property is valid only when saving in LEAD Proprietary T44 format using the MrcSegmenter.SaveImage method. When using the MrcSegmenter.SaveImageT44 method, all 2-bit grayscale segments are treated as picture segments. This property is used only if MrcImageFormat.Mrc or MrcImageFormat.MrcTif is set in the format parameter of either MrcSegmenter.SaveImage or MrcSegmenter.SaveImageT44 methods.

Example
C#
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.Mrc; 
 
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:\LEADTOOLS22\Resources\Images"; 
} 
Requirements

Target Platforms

Help Version 22.0.2023.4.12
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Mrc Assembly

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.