Navigation C API Pages Python bindings Applications

Floyd-Steinberg Dithering

A simple program that loads image, dithers it and saves result.

#!/usr/bin/env python
import sys

import gfxprim.core as core
import gfxprim.loaders as loaders
import gfxprim.filters as filters

def main():
    if len(sys.argv) != 2:
        print("usage: image")

    # Load Image
    img = loaders.Load(sys.argv[1])
    # Use Floyd-Steinberg dithering
    res = img.filters.FloydSteinbergAlloc(core.C.PIXEL_G1)
    # Save result into grayscale png

if __name__ == '__main__':