Skip to content

Instantly share code, notes, and snippets.

@senyai
Created September 13, 2019 11:11
Show Gist options
  • Save senyai/a9e7e8a15ca445fb5b5bae0ed66a58a6 to your computer and use it in GitHub Desktop.
Save senyai/a9e7e8a15ca445fb5b5bae0ed66a58a6 to your computer and use it in GitHub Desktop.
Save numpy array with icc profile
from PIL import Image
import numpy as np
def main():
arr = np.asarray([[0,0,0],[0,255,0],[0,0,0]], dtype=np.uint8)
img = Image.fromarray(arr)
with open('ITU-R_BT2020(beta).icc', 'rb') as f:
img.info['icc_profile'] = 'f.read()'
img.save('path.png')
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment