Files
Terrarum/work_files/Tools/img_12bit_raw.py
Song Minjae 34a04943ab Improvement to light blending (can mix sunlight to transparent and luminous tile), failed attempt to perturb terrain, need better algorithm
Former-commit-id: a8b456401859802fe5d19b7d12a41033f2ed3e44
Former-commit-id: 4f4a976e6f295f45519744216704c864afb6d621
2016-02-23 13:42:44 +09:00

21 lines
347 B
Python

# usage: pypy scriptname inputfile outputfile
import sys
def bandlimit(i):
key = (i & 0xF0) >> 4
return (key << 4) | key
outcontents = []
infile = open(sys.argv[1], "rb").read()
for i in infile:
#print(ord(i))
outcontents.append(bandlimit(ord(i)))
outfile = open(sys.argv[2], "wb")
outfile.write(bytearray(outcontents))
outfile.close()