From ecb2eee2152ff782620e7fa44ae9aaa05218ad18 Mon Sep 17 00:00:00 2001 From: Keiran Date: Wed, 27 Mar 2019 23:38:55 -0400 Subject: [PATCH] initial --- gamma.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100755 gamma.py diff --git a/gamma.py b/gamma.py new file mode 100755 index 0000000..b731d0e --- /dev/null +++ b/gamma.py @@ -0,0 +1,14 @@ +#!/usr/bin/python3 + +GAMMA = 2.8 # correction factor +MAX_IN = 255 # top end of INPUT range +MAX_OUT = 255 # top end of OUTPUT range + +print('{ \\') +for index in range(MAX_IN): + if index > 0: + print(',', end='') + if index & 15 == 0: + print() + print('%3d' % ((index / MAX_IN) ** GAMMA * MAX_OUT + 0.5), end='') +print('}')