icc revision 328875
1139749Simp
259477Swpaul#------------------------------------------------------------------------------
359477Swpaul# $File: icc,v 1.5 2017/08/13 00:21:47 christos Exp $
459477Swpaul# icc:  file(1) magic for International Color Consortium file formats
559477Swpaul
659477Swpaul#
759477Swpaul# Color profiles as per the ICC's "Image technology colour management -
859477Swpaul# Architecture, profile format, and data structure" specification.
959477Swpaul# See
1059477Swpaul#
1159477Swpaul#	http://www.color.org/specification/ICC1v43_2010-12.pdf
1259477Swpaul#
1359477Swpaul# for Specification ICC.1:2010 (Profile version 4.3.0.0).
1459477Swpaul# URL: http://fileformats.archiveteam.org/wiki/ICC_profile
1559477Swpaul# Reference: http://www.color.org/iccmax/ICC.2-2016-7.pdf
1659477Swpaul# Update: Joerg Jenderek
1759477Swpaul#
1859477Swpaul# Bytes 36 to 39 contain a generic profile file signature of "acsp";
1959477Swpaul# bytes 40 to 43 "may be used to identify the primary platform/operating
2059477Swpaul# system framework for which the profile was created".
2159477Swpaul#
2259477Swpaul#	check and display ICC/ICM color profile
2359477Swpaul0	name	color-profile
2459477Swpaul>36	string		acsp
2559477Swpaul# skip ASCII like Cognacspirit.txt by month <= 12
2659477Swpaul>>26	ubeshort	<13
2759477Swpaul# platform/operating system. Only 5 mentioned
2859477Swpaul
2959477Swpaul#
3059477Swpaul# This appears to be what's used for Apple ColorSync profiles.
3159477Swpaul# Instead of adding that, Apple just changed the generic "acsp" entry
3259477Swpaul# to be for "ColorSync ICC Color Profile" rather than "Kodak Color
33119418Sobrien# Management System, ICC Profile".
34119418Sobrien# Yes, it's "APPL", not "AAPL"; see the spec.
35119418Sobrien>>>40	string		APPL		ColorSync
3659477Swpaul
37166680Sjkim# Microsoft ICM color profile
3859477Swpaul>>>40	string		MSFT		Microsoft
3959477Swpaul
4059477Swpaul# Yes, that's a blank after "SGI".
4159477Swpaul>>>40	string		SGI\ 		SGI
4259477Swpaul
43129876Sphk# XXX - is this what's used for the Sun KCMS or not?  The standard file
4459477Swpaul# uses just "acsp" for that, but Apple's file uses it for "ColorSync",
4559477Swpaul# and there *is* an identified "primary platform" value of SUNW.
4659477Swpaul>>>40	string		SUNW		Sun KCMS
4759477Swpaul
48157642Sps# 5th platform
4959477Swpaul>>>40	string		TGNT		Taligent
5059477Swpaul
5159477Swpaul# remaining "l" "e" of "color profile" printed later to avoid error
5259477Swpaul>>>40	string		x 		color profi
53109514Sobrien#>>>40	string		x		(%.4s)
5459477Swpaul!:mime	application/vnd.iccprofile
5559477Swpaul# for "ICM" extension only versions 2.x and for Kodak "CC" 2.0 is found
56117659Swpaul>>>8	ubyte		=2
57117659Swpaul# do not use empty message text to a avoid error like
58117659Swpaul# icc, 82: Warning: Current entry does not yet have a description for adding a EXTENSION type
59157642Sps# file.exe: could not find any valid magic files!
6059477Swpaul>>>>9	ubyte		!0		\ble
61119285Simp!:ext	icc/icm
62119285Simp# minor version
63118814Swpaul>>>>9	ubyte		=0		\bl
6459477Swpaul# Kodak colour management system
6559477Swpaul>>>>>4	string		=KCMS		\be
66105135Salfred!:ext	icc/icm/cc
67105135Salfred>>>>>4	string		!KCMS		\be
6859477Swpaul!:ext	icc/icm
69166037Sjkim>>>8	ubyte		!2		\ble
70166037Sjkim!:ext	icc
71170391Sdavidch# Profile version major.4bit-minor.sub1.sub2 like 4.3.0.0 (04300000h)
72204941Ssobomax>>>8	ubyte		x		%u
73204941Ssobomax>>>9	ubyte/16	x		\b.%u
74204941Ssobomax# reserved and shall be null but 205.205 in umx1220u.icm
75205299Sdavidch>>>10	ubyte		>0		\b.%u
76179772Sdavidch>>>>11	ubyte		>0		\b.%u
77166037Sjkim# preferred colour management module like appl CCMS KCMS Lino UCCM "Win " "FF  "
78166037Sjkim# skip space like in brmsl08f.icm and null like in brmsl09f.icm, brmsl07f.icm
7959477Swpaul>>>4	string		>\ 		\b, type %.2s
8059477Swpaul>>>>6	string		>\  		\b%.1s
8159477Swpaul>>>>>7	string		>\  		\b%.1s
8259477Swpaul# colour space "XYZ " "Lab " "RGB " CMYK GRAY ...
8395722Sphk>>>16	string		x		\b, %.3s
8459477Swpaul>>>19	string		>\  		\b%.1s
85229093Shselasky# Profile Connection Space (PCS) field usually "XYZ " or "Lab " but sometimes
8659477Swpaul# null or CMYK like in ISOcoated_v2_to_PSOcoated_v3_DeviceLink.icc
8759477Swpaul>>>20	string		>\0		\b/%.3s
8859477Swpaul>>>>23	string		>\ 		\b%.1s
8959477Swpaul# eleven device classes
9059477Swpaul>>>12	string		x		\b-%.4s device
9159477Swpaul# skip 00001964h in hpf69000.icc or 0h in XRDC50Q.ICM or " ROT" in brmsl05f.icm
9259477Swpaul>>>52	string		>\040
93166049Sjkim# skip "none" model like in "Trinitron Compatible 9300K G2.2.icm"
9459477Swpaul>>>>52	ubelong		!0x6e6f6e65
9559477Swpaul# device manufacturer field like "HP  " "IBM " EPSO
9659477Swpaul>>>>>48	string		x		\b, %.2s
9759477Swpaul>>>>>50	string		>\  		\b%.1s
9884145Sjlemon>>>>>51	string		>\  		\b%.1s
99215297Smarius# model like "ADI " "A265" and skip 20000404h in IS330.icm for RICOH RUSSIAN-SC
10084145Sjlemon>>>>>52	string		>\ \  		\b/%.3s
101215297Smarius>>>>>>55 string		>\  		\b%.1s
102114590Sps>>>>>52	string		x		model
103170391Sdavidch# creator (often same as manufacture) like HP SONY XROX or null like in A925A.icm
104114590Sps>>>80	string		>\0		by %.2s
105114590Sps>>>>82	string		>\  		\b%.1s
106204144Smarius>>>>>83	string		>\  		\b%.1s
107166676Sjkim# profile size
108166031Sjkim>>>0	ubelong		x		\b, %u bytes
109166673Sjkim# skip invalid date 0 like in linearSRGB.icc
110166031Sjkim>>>24	ubequad		!0
111166677Sjkim# datetime dd-mm-yyyy hh:mm:ss
112166031Sjkim>>>>28	ubeshort	x		\b, %u
113166032Sjkim# month <= 12
114166032Sjkim>>>>26	ubeshort	x		\b-%u
11559477Swpaul# year
116160078Syongari>>>>24	ubeshort	x		\b-%u
117221407Smarius# do not display midnight time like in CNHP8308.ICC
118221407Smarius>>>>30	ubequad&0xFFffFFffFFff0000	!0
119221407Smarius# hour <= 24
120221407Smarius>>>>>30	ubeshort	x		%u
121221407Smarius# minutes <= 59
122221407Smarius>>>>>32	ubeshort	x		\b:%.2u
123221407Smarius# seconds <= 59
124221407Smarius>>>>>34	ubeshort	x		\b:%.2u
125221407Smarius# vendor specific flags like 2 in HPCLJ5.ICM
126221407Smarius>>>44	ubeshort	>0		\b, 0x%x vendor flags
127221407Smarius# profile flags bits 0-2 of least 16 used by ICC
128221407Smarius#>>>44	ubelong		>0		\b, 0x%x flags
129221407Smarius# icEmbeddedProfileTrue
130221407Smarius>>>44	ubelong		&1		\b, embedded
131221407Smarius# icEmbeddedProfileFalse
132221407Smarius#>>>44	ubelong		^1		\b, not embedded
133221407Smarius# icUseWithEmbeddedDataOnly
134221407Smarius>>>44	ubelong		&2		\b, dependently
135221407Smarius# icUseAnywhere
136221407Smarius#>>>44	ubelong		^2		\b, independently
137221407Smarius>>>44	ubelong		&4		\b, MCS
138221407Smarius#>>>44	ubelong		^4		\b, no MCS
139221407Smarius# vendor specific device attributes 1~srgb.icc
140221407Smarius# E000D00h~CNB7QEDA.ICM C000A00h~CNB5FCAA.ICM 01040401h~CNB25PE3.ICM
141221407Smarius>>>56	ubelong		>0		\b, 0x%x vendor attribute
142230717Smarius# ICC device attributes bits 0-7 used
143230717Smarius#>>>60	ubelong		x		\b, 0x%x attribute
144230717Smarius# http://www.color.org/icc34.h
145221407Smarius>>>60	ubelong		&0x01		\b, transparent
146221713Syongari#>>>60	ubelong		^0x01		\b, reflective
147229357Syongari>>>60	ubelong		&0x02		\b, matte
148221407Smarius#>>>60	ubelong		^0x02		\b, glossy
149221407Smarius>>>60	ubelong		&0x04		\b, negative
150160078Syongari#>>>60	ubelong		^0x04		\b, positive
151160078Syongari>>>60	ubelong		&0x08		\b, black&white
152160078Syongari#>>>60	ubelong		^0x08		\b, colour
153221407Smarius>>>60	ubelong		&0x10		\b, non-paper
154221407Smarius#>>>60	ubelong		^0x10		\b, paper
155221407Smarius>>>60	ubelong		&0x20		\b, non-textured
156221407Smarius#>>>60	ubelong		^0x20		\b, textured
157221407Smarius>>>60	ubelong		&0x40		\b, non-isotropic
158221407Smarius#>>>60	ubelong		^0x40		\b, isotropic
159204989Ssobomax>>>60	ubelong		&0x80		\b, self-luminous
160204989Ssobomax#>>>60	ubelong		^0x80		\b, non-self-luminous
161170391Sdavidch# rendering intent 0-3 but 7AEA5027h in EE051__1.ICM 6CB1BCh in EE061__1.ICM
162204989Ssobomax>>>64	ubelong		>3		\b, 0x%x rendering intent
163204989Ssobomax#>>>64	ubelong		=0		\b, perceptual
164204989Ssobomax>>>64	ubelong		=1		\b, relative colorimetric
165204989Ssobomax>>>64	ubelong		=2		\b, saturation
166215353Sjkim>>>64	ubelong		=3		\b, absolute colorimetric
167204989Ssobomax# PCS illuminant (3*s15Fixed16Numbers) often 0000f6d6 00010000 0000d32d
168215353Sjkim>>>71	ubequad		!0xd6000100000000d3	\b, PCS
169215353Sjkim# usually X~0.9642*65536=63189.8112~63190=F6D5h ; but also found
170215353Sjkim# often F6D6 in gt5000r.icm, F6B8 in kodakce.icm, F6CA in RSWOP.icm
171215353Sjkim>>>>68	ubelong			!0x0000f6d5	X=0x%x
172215355Sjkim# usually Y=1.0~00010000h but Y=0 in brmsl07f.icm
173215355Sjkim>>>>72	ubelong			!0x00010000	Y=0x%x
174215353Sjkim# usually Z~0.8249*65536=54060.6464~54061=D32Dh ; but also found
175215353Sjkim# D2F7 in hp1200c.icm, often D32C in A925A.icm, D309 in RSWOP.icm , D2F8 in kodak_dc.icm
176215353Sjkim>>>>76	ubelong			!0x0000d32d	Z=0x%x
177215353Sjkim# Profile ID. MD5 fingerprinting method as defined in Internet RFC 1321.
178215353Sjkim>>>84	ubequad		>0		\b, 0x%llx MD5
179204989Ssobomax# reserved in older versions should be zero but also found CDCDCDCDCDCDCDCD
180204989Ssobomax#>>100	ubequad		x		\b 0x%llx reserved
181170391Sdavidch# tag table
182105135Salfred# 6 <= tags count <= 43
183150763Simp#>>>128	ubelong		>43		\b, %u tags
18459477Swpaul>>>128	ubelong		x
185215297Smarius# shall contain the profileDescriptionTag "desc" , copyrightTag "cprt"
186170391Sdavidch# search range = tags count * 12 -8=< maximal tag count * 12 -8= 43 * 12 -8= 508
18759477Swpaul>>>>132	search/508	cprt
18859477Swpaul# but no copyright tag in linearSRGB.icc
189170391Sdavidch# beneath /System/Library/Frameworks/WebKit.framework/
190105135Salfred# Versions/A/Frameworks/WebCore.framework/Versions/A/Resources
191150763Simp>>>>132	default		x		\b, no copyright tag
19259477Swpaul# 1st tag
193166037Sjkim#>>>132	string		x		\b, 1st tag %.4s
194170391Sdavidch#>>>136	ubelong		x		0x%x offset
195170391Sdavidch#>>>140	ubelong		x		0x%x len
19659477Swpaul# 2nd tag,...
197170391Sdavidch# look also for profileDescriptionTag "desc"
19859477Swpaul>>>132	search/508	desc
199166037Sjkim# look further for TextDescriptionType "desc" signature
200166037Sjkim>>>>(&0.L)	string		=desc
20159477Swpaul>>>>>&4		pstring/l	x	"%s"
202221407Smarius# look alternative for multiLocalizedUnicodeType "mluc" signature like in VideoPAL.icc
203221407Smarius>>>>(&0.L)	string		=mluc
204213364Smarius>>>>>&(&8.L)	ubequad		x
205170391Sdavidch>>>>>>&4	bestring16	x	'%s'
206170391Sdavidch
207170391Sdavidch# Any other profile.
208221407Smarius# XXX - should we use "acsp\0\0\0\0" for "no primary platform" profiles,
209181617Syongari# and use "acsp" for everything else and dump the "primary platform"
210221407Smarius# string in those cases?
211221407Smarius36	string		acsp
212221407Smarius>0	use		color-profile
213205299Sdavidch
214205299Sdavidch
215205299Sdavidch