public int PictureQualityFactor { get; set; }
Possible values are between 2 and 255, where 2 is the highest quality and 255 is the most compression. If the PictureCoder is CMW or JPEG lossless compression, the PictureQualityFactor should be 0.
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:\LEADTOOLS23\Resources\Images";
}