diff options
author | Thomas Groman <tgroman@nuegia.net> | 2020-04-20 20:56:28 -0700 |
---|---|---|
committer | Thomas Groman <tgroman@nuegia.net> | 2020-04-20 20:56:28 -0700 |
commit | 508d270a4d78d491bbe1c67c309c404f547da58a (patch) | |
tree | d16e2a906501dcda7b4d268579896f03e125f553 /build/pypng/mkiccp.py | |
parent | f9cab004186edb425a9b88ad649726605080a17c (diff) | |
download | webbrowser-508d270a4d78d491bbe1c67c309c404f547da58a.tar webbrowser-508d270a4d78d491bbe1c67c309c404f547da58a.tar.gz webbrowser-508d270a4d78d491bbe1c67c309c404f547da58a.tar.lz webbrowser-508d270a4d78d491bbe1c67c309c404f547da58a.tar.xz webbrowser-508d270a4d78d491bbe1c67c309c404f547da58a.zip |
added Comm Build System
Diffstat (limited to 'build/pypng/mkiccp.py')
-rw-r--r-- | build/pypng/mkiccp.py | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/build/pypng/mkiccp.py b/build/pypng/mkiccp.py new file mode 100644 index 0000000..08e8df6 --- /dev/null +++ b/build/pypng/mkiccp.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python +# $URL: http://pypng.googlecode.com/svn/trunk/code/mkiccp.py $ +# $Rev: 182 $ +# Make ICC Profile + +# References +# +# [ICC 2001] ICC Specification ICC.1:2001-04 (Profile version 2.4.0) +# [ICC 2004] ICC Specification ICC.1:2004-10 (Profile version 4.2.0.0) + +import struct + +# Local module. +import iccp + +def black(m): + """Return a function that maps all values from [0.0,m] to 0, and maps + the range [m,1.0] into [0.0, 1.0] linearly. + """ + + m = float(m) + + def f(x): + if x <= m: + return 0.0 + return (x-m)/(1.0-m) + return f + +# For monochrome input the required tags are (See [ICC 2001] 6.3.1.1): +# profileDescription [ICC 2001] 6.4.32 +# grayTRC [ICC 2001] 6.4.19 +# mediaWhitePoint [ICC 2001] 6.4.25 +# copyright [ICC 2001] 6.4.13 + +def agreyprofile(out): + it = iccp.Profile().greyInput() + it.addTags(kTRC=black(0.07)) + it.write(out) + +def main(): + import sys + agreyprofile(sys.stdout) + +if __name__ == '__main__': + main() |