doc: Fix typos in GP_TempAlloc() documentation.
[gfxprim/pasky.git] / demos / py_simple / dither.py
blobd2b9e043c0cf31f4777b5cbbea768f81c29b6aae
1 #!/usr/bin/env python
2 import sys
4 import gfxprim.core as core
5 import gfxprim.loaders as loaders
6 import gfxprim.filters as filters
8 def main():
9 if len(sys.argv) != 2:
10 print("usage: dither.py image")
11 sys.exit(1)
13 # Load Image
14 img = loaders.Load(sys.argv[1])
15 # Use Floyd-Steinberg dithering
16 res = img.filters.FloydSteinbergAlloc(core.C.PIXEL_G1)
17 # Save result into grayscale png
18 res.loaders.SavePNG("out.png")
20 if __name__ == '__main__':
21 main()