2 #------------------------------------------------------------------------------
3 # $File: icc,v 1.5 2017/08/13 00:21:47 christos Exp $
4 # icc: file(1) magic for International Color Consortium file formats
7 # Color profiles as per the ICC's "Image technology colour management -
8 # Architecture, profile format, and data structure" specification.
11 # http://www.color.org/specification/ICC1v43_2010-12.pdf
13 # for Specification ICC.1:2010 (Profile version 4.3.0.0).
14 # URL: http://fileformats.archiveteam.org/wiki/ICC_profile
15 # Reference: http://www.color.org/iccmax/ICC.2-2016-7.pdf
16 # Update: Joerg Jenderek
18 # Bytes 36 to 39 contain a generic profile file signature of "acsp";
19 # bytes 40 to 43 "may be used to identify the primary platform/operating
20 # system framework for which the profile was created".
22 # check and display ICC/ICM color profile
25 # skip ASCII like Cognacspirit.txt by month <= 12
27 # platform/operating system. Only 5 mentioned
30 # This appears to be what's used for Apple ColorSync profiles.
31 # Instead of adding that, Apple just changed the generic "acsp" entry
32 # to be for "ColorSync ICC Color Profile" rather than "Kodak Color
33 # Management System, ICC Profile".
34 # Yes, it's "APPL", not "AAPL"; see the spec.
35 >>>40 string APPL ColorSync
37 # Microsoft ICM color profile
38 >>>40 string MSFT Microsoft
40 # Yes, that's a blank after "SGI".
43 # XXX - is this what's used for the Sun KCMS or not? The standard file
44 # uses just "acsp" for that, but Apple's file uses it for "ColorSync",
45 # and there *is* an identified "primary platform" value of SUNW.
46 >>>40 string SUNW Sun KCMS
49 >>>40 string TGNT Taligent
51 # remaining "l" "e" of "color profile" printed later to avoid error
52 >>>40 string x color profi
53 #>>>40 string x (%.4s)
54 !:mime application/vnd.iccprofile
55 # for "ICM" extension only versions 2.x and for Kodak "CC" 2.0 is found
57 # do not use empty message text to a avoid error like
58 # icc, 82: Warning: Current entry does not yet have a description for adding a EXTENSION type
59 # file.exe: could not find any valid magic files!
64 # Kodak colour management system
65 >>>>>4 string =KCMS \be
67 >>>>>4 string !KCMS \be
71 # Profile version major.4bit-minor.sub1.sub2 like 4.3.0.0 (04300000h)
74 # reserved and shall be null but 205.205 in umx1220u.icm
77 # preferred colour management module like appl CCMS KCMS Lino UCCM "Win " "FF "
78 # skip space like in brmsl08f.icm and null like in brmsl09f.icm, brmsl07f.icm
79 >>>4 string >\ \b, type %.2s
80 >>>>6 string >\ \b%.1s
81 >>>>>7 string >\ \b%.1s
82 # colour space "XYZ " "Lab " "RGB " CMYK GRAY ...
83 >>>16 string x \b, %.3s
84 >>>19 string >\ \b%.1s
85 # Profile Connection Space (PCS) field usually "XYZ " or "Lab " but sometimes
86 # null or CMYK like in ISOcoated_v2_to_PSOcoated_v3_DeviceLink.icc
87 >>>20 string >\0 \b/%.3s
88 >>>>23 string >\ \b%.1s
89 # eleven device classes
90 >>>12 string x \b-%.4s device
91 # skip 00001964h in hpf69000.icc or 0h in XRDC50Q.ICM or " ROT" in brmsl05f.icm
93 # skip "none" model like in "Trinitron Compatible 9300K G2.2.icm"
94 >>>>52 ubelong !0x6e6f6e65
95 # device manufacturer field like "HP " "IBM " EPSO
96 >>>>>48 string x \b, %.2s
97 >>>>>50 string >\ \b%.1s
98 >>>>>51 string >\ \b%.1s
99 # model like "ADI " "A265" and skip 20000404h in IS330.icm for RICOH RUSSIAN-SC
100 >>>>>52 string >\ \ \b/%.3s
101 >>>>>>55 string >\ \b%.1s
102 >>>>>52 string x model
103 # creator (often same as manufacture) like HP SONY XROX or null like in A925A.icm
104 >>>80 string >\0 by %.2s
105 >>>>82 string >\ \b%.1s
106 >>>>>83 string >\ \b%.1s
108 >>>0 ubelong x \b, %u bytes
109 # skip invalid date 0 like in linearSRGB.icc
111 # datetime dd-mm-yyyy hh:mm:ss
112 >>>>28 ubeshort x \b, %u
114 >>>>26 ubeshort x \b-%u
116 >>>>24 ubeshort x \b-%u
117 # do not display midnight time like in CNHP8308.ICC
118 >>>>30 ubequad&0xFFffFFffFFff0000 !0
120 >>>>>30 ubeshort x %u
122 >>>>>32 ubeshort x \b:%.2u
124 >>>>>34 ubeshort x \b:%.2u
125 # vendor specific flags like 2 in HPCLJ5.ICM
126 >>>44 ubeshort >0 \b, 0x%x vendor flags
127 # profile flags bits 0-2 of least 16 used by ICC
128 #>>>44 ubelong >0 \b, 0x%x flags
129 # icEmbeddedProfileTrue
130 >>>44 ubelong &1 \b, embedded
131 # icEmbeddedProfileFalse
132 #>>>44 ubelong ^1 \b, not embedded
133 # icUseWithEmbeddedDataOnly
134 >>>44 ubelong &2 \b, dependently
136 #>>>44 ubelong ^2 \b, independently
137 >>>44 ubelong &4 \b, MCS
138 #>>>44 ubelong ^4 \b, no MCS
139 # vendor specific device attributes 1~srgb.icc
140 # E000D00h~CNB7QEDA.ICM C000A00h~CNB5FCAA.ICM 01040401h~CNB25PE3.ICM
141 >>>56 ubelong >0 \b, 0x%x vendor attribute
142 # ICC device attributes bits 0-7 used
143 #>>>60 ubelong x \b, 0x%x attribute
144 # http://www.color.org/icc34.h
145 >>>60 ubelong &0x01 \b, transparent
146 #>>>60 ubelong ^0x01 \b, reflective
147 >>>60 ubelong &0x02 \b, matte
148 #>>>60 ubelong ^0x02 \b, glossy
149 >>>60 ubelong &0x04 \b, negative
150 #>>>60 ubelong ^0x04 \b, positive
151 >>>60 ubelong &0x08 \b, black&white
152 #>>>60 ubelong ^0x08 \b, colour
153 >>>60 ubelong &0x10 \b, non-paper
154 #>>>60 ubelong ^0x10 \b, paper
155 >>>60 ubelong &0x20 \b, non-textured
156 #>>>60 ubelong ^0x20 \b, textured
157 >>>60 ubelong &0x40 \b, non-isotropic
158 #>>>60 ubelong ^0x40 \b, isotropic
159 >>>60 ubelong &0x80 \b, self-luminous
160 #>>>60 ubelong ^0x80 \b, non-self-luminous
161 # rendering intent 0-3 but 7AEA5027h in EE051__1.ICM 6CB1BCh in EE061__1.ICM
162 >>>64 ubelong >3 \b, 0x%x rendering intent
163 #>>>64 ubelong =0 \b, perceptual
164 >>>64 ubelong =1 \b, relative colorimetric
165 >>>64 ubelong =2 \b, saturation
166 >>>64 ubelong =3 \b, absolute colorimetric
167 # PCS illuminant (3*s15Fixed16Numbers) often 0000f6d6 00010000 0000d32d
168 >>>71 ubequad !0xd6000100000000d3 \b, PCS
169 # usually X~0.9642*65536=63189.8112~63190=F6D5h ; but also found
170 # often F6D6 in gt5000r.icm, F6B8 in kodakce.icm, F6CA in RSWOP.icm
171 >>>>68 ubelong !0x0000f6d5 X=0x%x
172 # usually Y=1.0~00010000h but Y=0 in brmsl07f.icm
173 >>>>72 ubelong !0x00010000 Y=0x%x
174 # usually Z~0.8249*65536=54060.6464~54061=D32Dh ; but also found
175 # D2F7 in hp1200c.icm, often D32C in A925A.icm, D309 in RSWOP.icm , D2F8 in kodak_dc.icm
176 >>>>76 ubelong !0x0000d32d Z=0x%x
177 # Profile ID. MD5 fingerprinting method as defined in Internet RFC 1321.
178 >>>84 ubequad >0 \b, 0x%llx MD5
179 # reserved in older versions should be zero but also found CDCDCDCDCDCDCDCD
180 #>>100 ubequad x \b 0x%llx reserved
182 # 6 <= tags count <= 43
183 #>>>128 ubelong >43 \b, %u tags
185 # shall contain the profileDescriptionTag "desc" , copyrightTag "cprt"
186 # search range = tags count * 12 -8=< maximal tag count * 12 -8= 43 * 12 -8= 508
187 >>>>132 search/508 cprt
188 # but no copyright tag in linearSRGB.icc
189 # beneath /System/Library/Frameworks/WebKit.framework/
190 # Versions/A/Frameworks/WebCore.framework/Versions/A/Resources
191 >>>>132 default x \b, no copyright tag
193 #>>>132 string x \b, 1st tag %.4s
194 #>>>136 ubelong x 0x%x offset
195 #>>>140 ubelong x 0x%x len
197 # look also for profileDescriptionTag "desc"
198 >>>132 search/508 desc
199 # look further for TextDescriptionType "desc" signature
200 >>>>(&0.L) string =desc
201 >>>>>&4 pstring/l x "%s"
202 # look alternative for multiLocalizedUnicodeType "mluc" signature like in VideoPAL.icc
203 >>>>(&0.L) string =mluc
204 >>>>>&(&8.L) ubequad x
205 >>>>>>&4 bestring16 x '%s'
208 # XXX - should we use "acsp\0\0\0\0" for "no primary platform" profiles,
209 # and use "acsp" for everything else and dump the "primary platform"
210 # string in those cases?