from ctypes import *
from enum import IntEnum
[docs]
class DitheringMode(IntEnum):
"""
The dithering algorithm for converting to bitonal images
Dithering is the process of converting continuous-tone (grayscale or color) content
to black-and-white (bitonal) representation.
Different algorithms offer trade-offs between visual quality and compression efficiency.
Attributes:
NONE (int):
Simple thresholding without dithering.
Best for clean line art and text-only documents.
HALFTONE (int):
Ordered halftone dithering using a periodic pattern.
Provides a good balance between visual quality and compression.
FLOYD_STEINBERG (int):
Error diffusion dithering that distributes quantization errors to neighboring pixels.
Produces high-quality results, especially for photographic content.
ATKINSON (int):
A variant of error diffusion dithering that produces results with good compression characteristics.
"""
NONE = 0
HALFTONE = 1
FLOYD_STEINBERG = 2
ATKINSON = 3