ImageBinarizationMethod enumeration
ImageBinarizationMethod enumeration
Specifies the method used to binarize image.
Members
Name | Description |
---|---|
THRESHOLD | Specifies threshold method. |
FLOYD_STEINBERG_DITHERING | Specifies dithering using Floyd-Steinberg error diffusion method. |
Examples
Shows how to set the TIFF binarization error threshold when using the Floyd-Steinberg method to render a TIFF image.
doc = aw.Document()
builder = aw.DocumentBuilder(doc=doc)
builder.paragraph_format.style = doc.styles.get_by_name('Heading 1')
builder.writeln('Hello world!')
builder.insert_image(file_name=IMAGE_DIR + '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.
options = aw.saving.ImageSaveOptions(aw.SaveFormat.TIFF)
options.tiff_compression = aw.saving.TiffCompression.CCITT3
options.tiff_binarization_method = aw.saving.ImageBinarizationMethod.FLOYD_STEINBERG_DITHERING
options.threshold_for_floyd_steinberg_dithering = 240
doc.save(file_name=ARTIFACTS_DIR + 'ImageSaveOptions.FloydSteinbergDithering.tiff', save_options=options)
See Also
- module aspose.words.saving