Navigation C API Pages Python bindings Applications

Floyd-Steinberg Dithering

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

#!/usr/bin/env python3
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.floyd_steinberg_alloc(core.C.PIXEL_G1)
    # Save result into grayscale png

if __name__ == '__main__':