icc 7.7 KB

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