Class ImageBinarizationOptions

Class ImageBinarizationOptions

Namespace: Aspose.Note.Saving
Assembly: Aspose.Note.dll (24.12.0)

Options for image’s binarization.

public class ImageBinarizationOptions

Inheritance

objectImageBinarizationOptions

Inherited Members

object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Examples

Shows how to save a document as binary image using Otsu’s method.```csharp // The path to the documents directory. string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                                        // Load the document into Aspose.Note.
                                                                        Document oneFile = new Document(dataDir + "Aspose.one");

                                                                        dataDir = dataDir + "SaveToBinaryImageUsingOtsuMethod_out.png";

                                                                        // Save the document as gif.
                                                                        oneFile.Save(dataDir, new ImageSaveOptions(SaveFormat.Png)
                                                                                                {
                                                                                                    ColorMode = ColorMode.BlackAndWhite,
                                                                                                    BinarizationOptions = new ImageBinarizationOptions()
                                                                                                                          {
                                                                                                                              BinarizationMethod = BinarizationMethod.Otsu,
                                                                                                                          }
                                                                                                });

Shows how to save a document as binary image using fixed threshold.```csharp
// The path to the documents directory.
                                                                              string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                                              // Load the document into Aspose.Note.
                                                                              Document oneFile = new Document(dataDir + "Aspose.one");

                                                                              dataDir = dataDir + "SaveToBinaryImageUsingFixedThreshold_out.png";

                                                                              // Save the document as gif.
                                                                              oneFile.Save(dataDir, new ImageSaveOptions(SaveFormat.Png)
                                                                                                        {
                                                                                                            ColorMode = ColorMode.BlackAndWhite,
                                                                                                            BinarizationOptions = new ImageBinarizationOptions()
                                                                                                                                      {
                                                                                                                                          BinarizationMethod = BinarizationMethod.FixedThreshold,
                                                                                                                                          BinarizationThreshold = 123
                                                                                                                                      }
                                                                                                        });

Constructors

ImageBinarizationOptions()

public ImageBinarizationOptions()

Properties

BinarizationMethod

Gets or sets the binarization method. The default value is Aspose.Note.Saving.BinarizationMethod.FixedThreshold.

public BinarizationMethod BinarizationMethod { get; set; }

Property Value

BinarizationMethod

Examples

Shows how to save a document as binary image using Otsu’s method.```csharp // The path to the documents directory. string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                                        // Load the document into Aspose.Note.
                                                                        Document oneFile = new Document(dataDir + "Aspose.one");

                                                                        dataDir = dataDir + "SaveToBinaryImageUsingOtsuMethod_out.png";

                                                                        // Save the document as gif.
                                                                        oneFile.Save(dataDir, new ImageSaveOptions(SaveFormat.Png)
                                                                                                {
                                                                                                    ColorMode = ColorMode.BlackAndWhite,
                                                                                                    BinarizationOptions = new ImageBinarizationOptions()
                                                                                                                          {
                                                                                                                              BinarizationMethod = BinarizationMethod.Otsu,
                                                                                                                          }
                                                                                                });

Shows how to save a document as binary image using fixed threshold.```csharp
// The path to the documents directory.
                                                                              string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                                              // Load the document into Aspose.Note.
                                                                              Document oneFile = new Document(dataDir + "Aspose.one");

                                                                              dataDir = dataDir + "SaveToBinaryImageUsingFixedThreshold_out.png";

                                                                              // Save the document as gif.
                                                                              oneFile.Save(dataDir, new ImageSaveOptions(SaveFormat.Png)
                                                                                                        {
                                                                                                            ColorMode = ColorMode.BlackAndWhite,
                                                                                                            BinarizationOptions = new ImageBinarizationOptions()
                                                                                                                                      {
                                                                                                                                          BinarizationMethod = BinarizationMethod.FixedThreshold,
                                                                                                                                          BinarizationThreshold = 123
                                                                                                                                      }
                                                                                                        });

BinarizationThreshold

Gets or sets threshold value for fixed threshold binarization method. The default value is 128.

public byte BinarizationThreshold { get; set; }

Property Value

byte

Examples

Shows how to save a document as binary image using fixed threshold.```csharp // The path to the documents directory. string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                                          // Load the document into Aspose.Note.
                                                                          Document oneFile = new Document(dataDir + "Aspose.one");

                                                                          dataDir = dataDir + "SaveToBinaryImageUsingFixedThreshold_out.png";

                                                                          // Save the document as gif.
                                                                          oneFile.Save(dataDir, new ImageSaveOptions(SaveFormat.Png)
                                                                                                    {
                                                                                                        ColorMode = ColorMode.BlackAndWhite,
                                                                                                        BinarizationOptions = new ImageBinarizationOptions()
                                                                                                                                  {
                                                                                                                                      BinarizationMethod = BinarizationMethod.FixedThreshold,
                                                                                                                                      BinarizationThreshold = 123
                                                                                                                                  }
                                                                                                    });