Skip to content

Instantly share code, notes, and snippets.

@taikomatsu
Last active September 13, 2020 20:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save taikomatsu/a9b0cadc8039e7fc5c20353a6192d088 to your computer and use it in GitHub Desktop.
Save taikomatsu/a9b0cadc8039e7fc5c20353a6192d088 to your computer and use it in GitHub Desktop.
Read .acv(binary tone curve file) to convert to Nuke (wip)
# AEの.acvファイルをNukeに持っていく用にリサーチ
# 冒頭4バイトはヘッダ?処理に必要そうなものではなかったので一旦無視
# その後はマスター, R, G, B, Aと全5チャンネル分の情報が、
# 制御点の個数, (制御点の位置(x), 制御点の値(y)) x 個数分 という感じで全チャンネル分記載されていた
### 注意 ###
# Jupyterで書いてたためPython3.xなのでそのままだとDCCでは使えないかもしれない、、
filepath = 'C:/users/hoge/curve.acv'
with open(filepath, 'rb') as f:
header = f.read(4)
for i in range(len('mrgba')):
ncvs = f.read(2)[1]
content = f.read(2*2*ncvs)[1::2]
ipairs = zip(content[::2], content[1::2])
pairs = [(ix/255., iy/255.) for iy, ix in ipairs]
print(pairs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment