Debian Codegraph @

util/find_identity_curve_profiles.py

raw
1 #!/usr/bin/env python3
2 import os
3 import sys
4
5 sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
6
7 from DisplayCAL import ICCProfile as iccp
8 from DisplayCAL.defaultpaths import ICCPROFILES, ICCPROFILES_HOME
9
10
11 for p in set(ICCPROFILES_HOME + ICCPROFILES):
12 if os.path.isdir(p):
13 for f in os.listdir(p):
14 try:
15 profile = iccp.ICCProfile(os.path.join(p, f))
16 except Exception:
17 pass
18 else:
19 curve = None
20 for key in ("r", "g", "b", "k"):
21 curve = profile.tags.get(key + "TRC")
22 if curve:
23 break
24 if (
25 curve
26 and isinstance(curve, iccp.CurveType)
27 and len(curve) == 1
28 and curve[0] < 1.8
29 ):
30 print(f)
31 print(curve)
32 print("")