globals.js 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  1. export const fieldTagNames = {
  2. // TIFF Baseline
  3. 0x013B: 'Artist',
  4. 0x0102: 'BitsPerSample',
  5. 0x0109: 'CellLength',
  6. 0x0108: 'CellWidth',
  7. 0x0140: 'ColorMap',
  8. 0x0103: 'Compression',
  9. 0x8298: 'Copyright',
  10. 0x0132: 'DateTime',
  11. 0x0152: 'ExtraSamples',
  12. 0x010A: 'FillOrder',
  13. 0x0121: 'FreeByteCounts',
  14. 0x0120: 'FreeOffsets',
  15. 0x0123: 'GrayResponseCurve',
  16. 0x0122: 'GrayResponseUnit',
  17. 0x013C: 'HostComputer',
  18. 0x010E: 'ImageDescription',
  19. 0x0101: 'ImageLength',
  20. 0x0100: 'ImageWidth',
  21. 0x010F: 'Make',
  22. 0x0119: 'MaxSampleValue',
  23. 0x0118: 'MinSampleValue',
  24. 0x0110: 'Model',
  25. 0x00FE: 'NewSubfileType',
  26. 0x0112: 'Orientation',
  27. 0x0106: 'PhotometricInterpretation',
  28. 0x011C: 'PlanarConfiguration',
  29. 0x0128: 'ResolutionUnit',
  30. 0x0116: 'RowsPerStrip',
  31. 0x0115: 'SamplesPerPixel',
  32. 0x0131: 'Software',
  33. 0x0117: 'StripByteCounts',
  34. 0x0111: 'StripOffsets',
  35. 0x00FF: 'SubfileType',
  36. 0x0107: 'Threshholding',
  37. 0x011A: 'XResolution',
  38. 0x011B: 'YResolution',
  39. // TIFF Extended
  40. 0x0146: 'BadFaxLines',
  41. 0x0147: 'CleanFaxData',
  42. 0x0157: 'ClipPath',
  43. 0x0148: 'ConsecutiveBadFaxLines',
  44. 0x01B1: 'Decode',
  45. 0x01B2: 'DefaultImageColor',
  46. 0x010D: 'DocumentName',
  47. 0x0150: 'DotRange',
  48. 0x0141: 'HalftoneHints',
  49. 0x015A: 'Indexed',
  50. 0x015B: 'JPEGTables',
  51. 0x011D: 'PageName',
  52. 0x0129: 'PageNumber',
  53. 0x013D: 'Predictor',
  54. 0x013F: 'PrimaryChromaticities',
  55. 0x0214: 'ReferenceBlackWhite',
  56. 0x0153: 'SampleFormat',
  57. 0x0154: 'SMinSampleValue',
  58. 0x0155: 'SMaxSampleValue',
  59. 0x022F: 'StripRowCounts',
  60. 0x014A: 'SubIFDs',
  61. 0x0124: 'T4Options',
  62. 0x0125: 'T6Options',
  63. 0x0145: 'TileByteCounts',
  64. 0x0143: 'TileLength',
  65. 0x0144: 'TileOffsets',
  66. 0x0142: 'TileWidth',
  67. 0x012D: 'TransferFunction',
  68. 0x013E: 'WhitePoint',
  69. 0x0158: 'XClipPathUnits',
  70. 0x011E: 'XPosition',
  71. 0x0211: 'YCbCrCoefficients',
  72. 0x0213: 'YCbCrPositioning',
  73. 0x0212: 'YCbCrSubSampling',
  74. 0x0159: 'YClipPathUnits',
  75. 0x011F: 'YPosition',
  76. // EXIF
  77. 0x9202: 'ApertureValue',
  78. 0xA001: 'ColorSpace',
  79. 0x9004: 'DateTimeDigitized',
  80. 0x9003: 'DateTimeOriginal',
  81. 0x8769: 'Exif IFD',
  82. 0x9000: 'ExifVersion',
  83. 0x829A: 'ExposureTime',
  84. 0xA300: 'FileSource',
  85. 0x9209: 'Flash',
  86. 0xA000: 'FlashpixVersion',
  87. 0x829D: 'FNumber',
  88. 0xA420: 'ImageUniqueID',
  89. 0x9208: 'LightSource',
  90. 0x927C: 'MakerNote',
  91. 0x9201: 'ShutterSpeedValue',
  92. 0x9286: 'UserComment',
  93. // IPTC
  94. 0x83BB: 'IPTC',
  95. // ICC
  96. 0x8773: 'ICC Profile',
  97. // XMP
  98. 0x02BC: 'XMP',
  99. // GDAL
  100. 0xA480: 'GDAL_METADATA',
  101. 0xA481: 'GDAL_NODATA',
  102. // Photoshop
  103. 0x8649: 'Photoshop',
  104. // GeoTiff
  105. 0x830E: 'ModelPixelScale',
  106. 0x8482: 'ModelTiepoint',
  107. 0x85D8: 'ModelTransformation',
  108. 0x87AF: 'GeoKeyDirectory',
  109. 0x87B0: 'GeoDoubleParams',
  110. 0x87B1: 'GeoAsciiParams',
  111. // LERC
  112. 0xC5F2: 'LercParameters',
  113. };
  114. export const fieldTags = {};
  115. for (const key in fieldTagNames) {
  116. if (fieldTagNames.hasOwnProperty(key)) {
  117. fieldTags[fieldTagNames[key]] = parseInt(key, 10);
  118. }
  119. }
  120. export const fieldTagTypes = {
  121. 256: 'SHORT',
  122. 257: 'SHORT',
  123. 258: 'SHORT',
  124. 259: 'SHORT',
  125. 262: 'SHORT',
  126. 273: 'LONG',
  127. 274: 'SHORT',
  128. 277: 'SHORT',
  129. 278: 'LONG',
  130. 279: 'LONG',
  131. 282: 'RATIONAL',
  132. 283: 'RATIONAL',
  133. 284: 'SHORT',
  134. 286: 'SHORT',
  135. 287: 'RATIONAL',
  136. 296: 'SHORT',
  137. 297: 'SHORT',
  138. 305: 'ASCII',
  139. 306: 'ASCII',
  140. 338: 'SHORT',
  141. 339: 'SHORT',
  142. 513: 'LONG',
  143. 514: 'LONG',
  144. 1024: 'SHORT',
  145. 1025: 'SHORT',
  146. 2048: 'SHORT',
  147. 2049: 'ASCII',
  148. 3072: 'SHORT',
  149. 3073: 'ASCII',
  150. 33550: 'DOUBLE',
  151. 33922: 'DOUBLE',
  152. 34665: 'LONG',
  153. 34735: 'SHORT',
  154. 34737: 'ASCII',
  155. 42113: 'ASCII',
  156. };
  157. export const arrayFields = [
  158. fieldTags.BitsPerSample,
  159. fieldTags.ExtraSamples,
  160. fieldTags.SampleFormat,
  161. fieldTags.StripByteCounts,
  162. fieldTags.StripOffsets,
  163. fieldTags.StripRowCounts,
  164. fieldTags.TileByteCounts,
  165. fieldTags.TileOffsets,
  166. fieldTags.SubIFDs,
  167. ];
  168. export const fieldTypeNames = {
  169. 0x0001: 'BYTE',
  170. 0x0002: 'ASCII',
  171. 0x0003: 'SHORT',
  172. 0x0004: 'LONG',
  173. 0x0005: 'RATIONAL',
  174. 0x0006: 'SBYTE',
  175. 0x0007: 'UNDEFINED',
  176. 0x0008: 'SSHORT',
  177. 0x0009: 'SLONG',
  178. 0x000A: 'SRATIONAL',
  179. 0x000B: 'FLOAT',
  180. 0x000C: 'DOUBLE',
  181. // IFD offset, suggested by https://owl.phy.queensu.ca/~phil/exiftool/standards.html
  182. 0x000D: 'IFD',
  183. // introduced by BigTIFF
  184. 0x0010: 'LONG8',
  185. 0x0011: 'SLONG8',
  186. 0x0012: 'IFD8',
  187. };
  188. export const fieldTypes = {};
  189. for (const key in fieldTypeNames) {
  190. if (fieldTypeNames.hasOwnProperty(key)) {
  191. fieldTypes[fieldTypeNames[key]] = parseInt(key, 10);
  192. }
  193. }
  194. export const photometricInterpretations = {
  195. WhiteIsZero: 0,
  196. BlackIsZero: 1,
  197. RGB: 2,
  198. Palette: 3,
  199. TransparencyMask: 4,
  200. CMYK: 5,
  201. YCbCr: 6,
  202. CIELab: 8,
  203. ICCLab: 9,
  204. };
  205. export const ExtraSamplesValues = {
  206. Unspecified: 0,
  207. Assocalpha: 1,
  208. Unassalpha: 2,
  209. };
  210. export const LercParameters = {
  211. Version: 0,
  212. AddCompression: 1,
  213. };
  214. export const LercAddCompression = {
  215. None: 0,
  216. Deflate: 1,
  217. };
  218. export const geoKeyNames = {
  219. 1024: 'GTModelTypeGeoKey',
  220. 1025: 'GTRasterTypeGeoKey',
  221. 1026: 'GTCitationGeoKey',
  222. 2048: 'GeographicTypeGeoKey',
  223. 2049: 'GeogCitationGeoKey',
  224. 2050: 'GeogGeodeticDatumGeoKey',
  225. 2051: 'GeogPrimeMeridianGeoKey',
  226. 2052: 'GeogLinearUnitsGeoKey',
  227. 2053: 'GeogLinearUnitSizeGeoKey',
  228. 2054: 'GeogAngularUnitsGeoKey',
  229. 2055: 'GeogAngularUnitSizeGeoKey',
  230. 2056: 'GeogEllipsoidGeoKey',
  231. 2057: 'GeogSemiMajorAxisGeoKey',
  232. 2058: 'GeogSemiMinorAxisGeoKey',
  233. 2059: 'GeogInvFlatteningGeoKey',
  234. 2060: 'GeogAzimuthUnitsGeoKey',
  235. 2061: 'GeogPrimeMeridianLongGeoKey',
  236. 2062: 'GeogTOWGS84GeoKey',
  237. 3072: 'ProjectedCSTypeGeoKey',
  238. 3073: 'PCSCitationGeoKey',
  239. 3074: 'ProjectionGeoKey',
  240. 3075: 'ProjCoordTransGeoKey',
  241. 3076: 'ProjLinearUnitsGeoKey',
  242. 3077: 'ProjLinearUnitSizeGeoKey',
  243. 3078: 'ProjStdParallel1GeoKey',
  244. 3079: 'ProjStdParallel2GeoKey',
  245. 3080: 'ProjNatOriginLongGeoKey',
  246. 3081: 'ProjNatOriginLatGeoKey',
  247. 3082: 'ProjFalseEastingGeoKey',
  248. 3083: 'ProjFalseNorthingGeoKey',
  249. 3084: 'ProjFalseOriginLongGeoKey',
  250. 3085: 'ProjFalseOriginLatGeoKey',
  251. 3086: 'ProjFalseOriginEastingGeoKey',
  252. 3087: 'ProjFalseOriginNorthingGeoKey',
  253. 3088: 'ProjCenterLongGeoKey',
  254. 3089: 'ProjCenterLatGeoKey',
  255. 3090: 'ProjCenterEastingGeoKey',
  256. 3091: 'ProjCenterNorthingGeoKey',
  257. 3092: 'ProjScaleAtNatOriginGeoKey',
  258. 3093: 'ProjScaleAtCenterGeoKey',
  259. 3094: 'ProjAzimuthAngleGeoKey',
  260. 3095: 'ProjStraightVertPoleLongGeoKey',
  261. 3096: 'ProjRectifiedGridAngleGeoKey',
  262. 4096: 'VerticalCSTypeGeoKey',
  263. 4097: 'VerticalCitationGeoKey',
  264. 4098: 'VerticalDatumGeoKey',
  265. 4099: 'VerticalUnitsGeoKey',
  266. };
  267. export const geoKeys = {};
  268. for (const key in geoKeyNames) {
  269. if (geoKeyNames.hasOwnProperty(key)) {
  270. geoKeys[geoKeyNames[key]] = parseInt(key, 10);
  271. }
  272. }