Enum ImageBinarizationMethod

Enum ImageBinarizationMethod

Namespace: Aspose.Words.Saving
Assembly: Aspose.Words.dll (25.12.0)

Specifies the method used to binarize image.

public enum ImageBinarizationMethod

Fields

FloydSteinbergDithering = 1

Specifies dithering using Floyd-Steinberg error diffusion method.

Threshold = 0

Specifies threshold method.

Examples

Shows how to set the TIFF binarization error threshold when using the Floyd-Steinberg method to render a TIFF image.

Document doc = new Document();
                                                                                                                               DocumentBuilder builder = new DocumentBuilder(doc);

                                                                                                                               builder.ParagraphFormat.Style = doc.Styles["Heading 1"];
                                                                                                                               builder.Writeln("Hello world!");
                                                                                                                               builder.InsertImage(ImageDir + "Logo.jpg");

                                                                                                                               // When we save the document as a TIFF, we can pass a SaveOptions object to
                                                                                                                               // adjust the dithering that Aspose.Words will apply when rendering this image.
                                                                                                                               // The default value of the "ThresholdForFloydSteinbergDithering" property is 128.
                                                                                                                               // Higher values tend to produce darker images.
                                                                                                                               ImageSaveOptions options = new ImageSaveOptions(SaveFormat.Tiff)
                                                                                                                               {
                                                                                                                                   TiffCompression = TiffCompression.Ccitt3,
                                                                                                                                   TiffBinarizationMethod = ImageBinarizationMethod.FloydSteinbergDithering,
                                                                                                                                   ThresholdForFloydSteinbergDithering = 240
                                                                                                                               };

                                                                                                                               doc.Save(ArtifactsDir + "ImageSaveOptions.FloydSteinbergDithering.tiff", options);
 English