←Select platform

CodecsJbig2LoadOptions Class

Summary
Provides options specifically for loading JBIG2 images.
Syntax
C#
Objective-C
C++/CLI
Java
Python
public class CodecsJbig2LoadOptions  
@interface LTCodecsJbig2LoadOptions : NSObject 
public class CodecsJbig2LoadOptions 
public ref class CodecsJbig2LoadOptions  
class CodecsJbig2LoadOptions: 
Example
C#
Java
using Leadtools; 
using Leadtools.Codecs; 
 
using Leadtools.ImageProcessing.Core; 
using Leadtools.Pdf; 
 
public void CodecsJbig2OptionsExample() 
{ 
   RasterCodecs codecs = new RasterCodecs(); 
 
   string srcFileName = Path.Combine(LEAD_VARS.ImagesDir, "ocr1.tif"); 
   RasterImage srcImage = codecs.Load(srcFileName); 
   codecs.Options.Jbig2.Load.LoadOldFiles = false; // CodecsJbig2Options & CodecsJbig2LoadOptions reference 
 
   // Save as JBIG2 with Template #3 
   // CodecsJbig2SaveOptions reference. All properties are set to default values. 
   codecs.Options.Jbig2.Save.RemoveMarker = true; 
   codecs.Options.Jbig2.Save.EnableDictionary = true; 
   codecs.Options.Jbig2.Save.RemoveHeaderSegment = true; 
   codecs.Options.Jbig2.Save.RemoveEopSegment = true; 
   codecs.Options.Jbig2.Save.RemoveEofSegment = true; 
   codecs.Options.Jbig2.Save.ImageTypicalPredictionOn = true; 
   codecs.Options.Jbig2.Save.ImageTemplateType = 3; 
   codecs.Options.Jbig2.Save.ImageQualityFactor = 0; // Lossless image compression 
   codecs.Options.Jbig2.Save.ImageGbatX1 = -1; 
   codecs.Options.Jbig2.Save.ImageGbatX2 = -1; 
   codecs.Options.Jbig2.Save.ImageGbatX3 = -2; 
   codecs.Options.Jbig2.Save.ImageGbatX4 = -2; 
   codecs.Options.Jbig2.Save.ImageGbatY1 = -3; 
   codecs.Options.Jbig2.Save.ImageGbatY2 = 2; 
   codecs.Options.Jbig2.Save.ImageGbatY3 = -2; 
   codecs.Options.Jbig2.Save.ImageGbatY4 = 0; 
   codecs.Options.Jbig2.Save.TextDifferentialThreshold = 30; 
   codecs.Options.Jbig2.Save.TextGbatX1 = 3; 
   codecs.Options.Jbig2.Save.TextGbatX2 = -3; 
   codecs.Options.Jbig2.Save.TextGbatX3 = 2; 
   codecs.Options.Jbig2.Save.TextGbatX4 = -2; 
   codecs.Options.Jbig2.Save.TextGbatY1 = -1; 
   codecs.Options.Jbig2.Save.TextGbatY2 = -1; 
   codecs.Options.Jbig2.Save.TextGbatY3 = -2; 
   codecs.Options.Jbig2.Save.TextGbatY4 = -2; 
   codecs.Options.Jbig2.Save.TextKeepAllSymbols = true; 
   codecs.Options.Jbig2.Save.TextMaximumSymbolArea = 2000; 
   codecs.Options.Jbig2.Save.TextMaximumSymbolHeight = 200; 
   codecs.Options.Jbig2.Save.TextMaximumSymbolWidth = 200; 
   codecs.Options.Jbig2.Save.TextMinimumSymbolArea = 50; 
   codecs.Options.Jbig2.Save.TextMinimumSymbolHeight = 1; 
   codecs.Options.Jbig2.Save.TextMinimumSymbolWidth = 1; 
   codecs.Options.Jbig2.Save.TextQualityFactor = 0; // Lossless. 0 is the default value. Lossy is > 0 
   codecs.Options.Jbig2.Save.TextRemoveUnrepeatedSymbol = false; 
   codecs.Options.Jbig2.Save.TextTemplateType = 0; 
   codecs.Options.Jbig2.Save.XResolution = 150; 
   codecs.Options.Jbig2.Save.YResolution = 150; 
 
   codecs.Save(srcImage, Path.Combine(LEAD_VARS.ImagesDir, "jbig2.jb2"), RasterImageFormat.Jbig2, 1); 
 
   // Clean up 
   srcImage.Dispose(); 
   codecs.Dispose(); 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images"; 
} 
 
import java.io.File; 
import java.io.IOException; 
import java.net.URI; 
import java.net.URISyntaxException; 
import java.nio.file.Paths; 
 
import org.junit.*; 
import org.junit.runner.JUnitCore; 
import org.junit.runner.Result; 
import org.junit.runner.notification.Failure; 
import static org.junit.Assert.*; 
 
import leadtools.*; 
import leadtools.codecs.*; 
import leadtools.imageprocessing.core.MinMaxBitsCommand; 
 
 
public void codecsJbig2OptionsExample() { 
   final String LEAD_VARS_IMAGES_DIR = "C:\\LEADTOOLS23\\Resources\\Images"; 
   RasterCodecs codecs = new RasterCodecs(); 
   String srcFileName = combine(LEAD_VARS_IMAGES_DIR, "ocr1.tif"); 
   RasterImage srcImage = codecs.load(srcFileName); 
   codecs.getOptions().getJbig2().getLoad().setLoadOldFiles(false); // CodecsJbig2Options & CodecsJbig2LoadOptions 
                                                                    // reference 
 
   // Save as JBIG2 with Template #3 
   // CodecsJbig2SaveOptions reference. All properties are set to default values. 
   codecs.getOptions().getJbig2().getSave().setRemoveMarker(true); 
   codecs.getOptions().getJbig2().getSave().setEnableDictionary(true); 
   codecs.getOptions().getJbig2().getSave().setRemoveHeaderSegment(true); 
   codecs.getOptions().getJbig2().getSave().setRemoveEopSegment(true); 
   codecs.getOptions().getJbig2().getSave().setRemoveEofSegment(true); 
   codecs.getOptions().getJbig2().getSave().setImageTypicalPredictionOn(true); 
   codecs.getOptions().getJbig2().getSave().setImageTemplateType(3); 
   codecs.getOptions().getJbig2().getSave().setImageQualityFactor(0); // Lossless image compression 
   codecs.getOptions().getJbig2().getSave().setImageGbatX1(-1); 
   codecs.getOptions().getJbig2().getSave().setImageGbatX2(-1); 
   codecs.getOptions().getJbig2().getSave().setImageGbatX3(-2); 
   codecs.getOptions().getJbig2().getSave().setImageGbatX4(-2); 
   codecs.getOptions().getJbig2().getSave().setImageGbatY1(-3); 
   codecs.getOptions().getJbig2().getSave().setImageGbatY2(2); 
   codecs.getOptions().getJbig2().getSave().setImageGbatY3(-2); 
   codecs.getOptions().getJbig2().getSave().setImageGbatY4(0); 
   codecs.getOptions().getJbig2().getSave().setTextDifferentialThreshold(30); 
   codecs.getOptions().getJbig2().getSave().setTextGbatX1(3); 
   codecs.getOptions().getJbig2().getSave().setTextGbatX2(-3); 
   codecs.getOptions().getJbig2().getSave().setTextGbatX3(2); 
   codecs.getOptions().getJbig2().getSave().setTextGbatX4(-2); 
   codecs.getOptions().getJbig2().getSave().setTextGbatY1(-1); 
   codecs.getOptions().getJbig2().getSave().setTextGbatY2(-1); 
   codecs.getOptions().getJbig2().getSave().setTextGbatY3(-2); 
   codecs.getOptions().getJbig2().getSave().setTextGbatY4(-2); 
   codecs.getOptions().getJbig2().getSave().setTextKeepAllSymbols(true); 
   codecs.getOptions().getJbig2().getSave().setTextMaximumSymbolArea(2000); 
   codecs.getOptions().getJbig2().getSave().setTextMaximumSymbolHeight(200); 
   codecs.getOptions().getJbig2().getSave().setTextMaximumSymbolWidth(200); 
   codecs.getOptions().getJbig2().getSave().setTextMinimumSymbolArea(50); 
   codecs.getOptions().getJbig2().getSave().setTextMinimumSymbolHeight(1); 
   codecs.getOptions().getJbig2().getSave().setTextMinimumSymbolWidth(1); 
   codecs.getOptions().getJbig2().getSave().setTextQualityFactor(0); // Lossless. 0 is the default value. Lossy is > 0 
   codecs.getOptions().getJbig2().getSave().setTextRemoveUnrepeatedSymbol(false); 
   codecs.getOptions().getJbig2().getSave().setTextTemplateType(0); 
   codecs.getOptions().getJbig2().getSave().setXResolution(150); 
   codecs.getOptions().getJbig2().getSave().setYResolution(150); 
 
   String outputFileName = combine(LEAD_VARS_IMAGES_DIR, "jbig2.jb2"); 
   codecs.save(srcImage, outputFileName, RasterImageFormat.JBIG2, 1); 
 
   assertTrue("File unsuccessfully saved to " + outputFileName, (new File(outputFileName)).exists()); 
   System.out.printf("File successfully saved to %s%n", outputFileName); 
 
   // Clean up 
   srcImage.dispose(); 
   codecs.dispose(); 
} 
Requirements

Target Platforms

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

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