@sswroom/sswr 1.5.3 → 1.5.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/media.js ADDED
@@ -0,0 +1,2271 @@
1
+ import * as data from "./data.js";
2
+ import * as text from "./text.js";
3
+
4
+ export const EXIFMaker = {
5
+ Standard: "Standard",
6
+ Panasonic: "Panasonic",
7
+ Canon: "Canon",
8
+ Olympus: "Olympus",
9
+ Casio1: "Casio Type 1",
10
+ Casio2: "Casio Type 2",
11
+ FLIR: "FLIR",
12
+ Nikon3: "Nikon Type 3",
13
+ Sanyo: "Sanyo Type 1",
14
+ Apple: "Apple"
15
+ };
16
+
17
+ export const EXIFType = {
18
+ Unknown: 0,
19
+ Bytes: 1,
20
+ STRING: 2,
21
+ UINT16: 3,
22
+ UINT32: 4,
23
+ Rational: 5,
24
+ Other: 6,
25
+ INT16: 7,
26
+ SubExif: 8,
27
+ INT32: 9,
28
+ SRational: 10,
29
+ Double: 11,
30
+ UINT64: 12,
31
+ INT64: 13
32
+ };
33
+
34
+ export function loadImageFromBlob(blob)
35
+ {
36
+ return new Promise(function (resolve, reject) {
37
+ const img = new Image();
38
+ img.addEventListener('load', function (e) {
39
+ resolve(e.target);
40
+ });
41
+
42
+ img.addEventListener('error', function () {
43
+ reject();
44
+ });
45
+
46
+ img.src = URL.createObjectURL(blob);
47
+ });
48
+ }
49
+
50
+ export class EXIFItem
51
+ {
52
+ constructor(id, type, data)
53
+ {
54
+ this.id = id;
55
+ this.type = type;
56
+ this.data = data;
57
+ }
58
+
59
+ clone()
60
+ {
61
+ if (this.type == EXIFType.SubExif)
62
+ {
63
+ return new EXIFItem(this.id, this.type, this.data.clone());
64
+ }
65
+ else
66
+ {
67
+ return new EXIFItem(this.id, this.type, this.data);
68
+ }
69
+ }
70
+
71
+ toDataString()
72
+ {
73
+ if (this.type == EXIFType.SubExif)
74
+ {
75
+ return "EXIF";
76
+ }
77
+ else if (this.type == EXIFType.Other)
78
+ {
79
+ return text.u8Arr2Hex(new Uint8Array(this.data), " ", "\n");
80
+ }
81
+ else if (this.type == EXIFType.Rational || this.type == EXIFType.SRational)
82
+ {
83
+ if (this.data.length == 2)
84
+ {
85
+ return this.data[0]+" / "+this.data[1]+" ("+(this.data[0] / this.data[1])+")";
86
+ }
87
+ else
88
+ {
89
+ let i = 0;
90
+ let j = this.data.length;
91
+ let ret = [];
92
+ while (i < j)
93
+ {
94
+ ret.push(this.data[0]+"/"+this.data[1]);
95
+ i += 2;
96
+ }
97
+ return ret.join(", ");
98
+ }
99
+ }
100
+ else if (typeof this.data == "string")
101
+ {
102
+ return this.data;
103
+ }
104
+ else
105
+ {
106
+ return this.data.join(", ");
107
+ }
108
+ }
109
+ }
110
+
111
+ const EXIFNamesStandard = {
112
+ "11": "ProcessingSoftware",
113
+ "254": "NewSubfileType",
114
+ "255": "SubfileType",
115
+ "256": "Width",
116
+ "257": "Height",
117
+ "258": "BitPerSample (R, G, B)",
118
+ "259": "Compression",
119
+ "262": "PhotometricInterpretation",
120
+ "263": "Threshholding",
121
+ "264": "CellWidth",
122
+ "265": "CellLength",
123
+ "266": "FillOrder",
124
+ "267": "DocumentName",
125
+ "270": "ImageDescription",
126
+ "271": "Make",
127
+ "272": "Model",
128
+ "273": "StripOffsets",
129
+ "274": "Orientation",
130
+ "277": "SamplesPerPixel",
131
+ "278": "RowsPerStrip",
132
+ "279": "StripByteCounts",
133
+ "280": "MinSampleValue",
134
+ "281": "MaxSampleValue",
135
+ "282": "XResolution",
136
+ "283": "YResolution",
137
+ "284": "PlanarConfiguration",
138
+ "285": "PageName",
139
+ "286": "XPosition",
140
+ "287": "YPosition",
141
+ "288": "FreeOffsets",
142
+ "289": "FreeByteCounts",
143
+ "290": "GrayResponseUnit",
144
+ "291": "GrayResponseCurve",
145
+ "292": "T4Options",
146
+ "293": "T6Options",
147
+ "296": "ResolutionUnit",
148
+ "297": "PageNumber",
149
+ "301": "TransferFunction",
150
+ "305": "Software",
151
+ "306": "DateTime",
152
+ "315": "Artist",
153
+ "316": "HostComputer",
154
+ "317": "Predictor",
155
+ "318": "WhitePoint",
156
+ "319": "PrimaryChromaticities",
157
+ "320": "ColorMap",
158
+ "321": "HalftoneHints",
159
+ "322": "TileWidth",
160
+ "323": "TileLength",
161
+ "324": "TileOffsets",
162
+ "325": "TileByteCounts",
163
+ "332": "InkSet",
164
+ "333": "InkNames",
165
+ "334": "NumberOfInks",
166
+ "336": "DotRange",
167
+ "337": "TargetPrinter",
168
+ "338": "ExtraSamples",
169
+ "339": "SampleFormat",
170
+ "340": "SMinSampleValue",
171
+ "341": "SMaxSampleValue",
172
+ "342": "TransferRange",
173
+ "343": "ClipPath",
174
+ "344": "XClipPathUnits",
175
+ "345": "YClipPathUnits",
176
+ "346": "Indexed",
177
+ "351": "OPIProxy",
178
+ "437": "JPEG tables",
179
+ "512": "JPEGProc",
180
+ "513": "JPEGInterchangeFormat",
181
+ "514": "JPEGInterchangeFormatLngth",
182
+ "515": "JPEGRestartInterval",
183
+ "517": "JPEGLosslessPredictors",
184
+ "518": "JPEGPointTransforms",
185
+ "519": "JPEGQTables",
186
+ "520": "JPEGDCTables",
187
+ "521": "JPEGACTables",
188
+ "529": "YCbCrCoefficients",
189
+ "530": "YCbCrSubSampling",
190
+ "531": "YCbCrPositioning",
191
+ "532": "ReferenceBlackWhite",
192
+ "700": "Photoshop XMP",
193
+ "32781": "ImageID",
194
+ "32995": "Matteing",
195
+ "32996": "DataType",
196
+ "32997": "ImageDepth",
197
+ "32998": "TileDepth",
198
+ "33421": "CFARepeatPatternDim",
199
+ "33422": "CFAPattern",
200
+ "33423": "BatteryLevel",
201
+ "33432": "Copyright",
202
+ "33434": "ExposureTime",
203
+ "33437": "Fnumber",
204
+ "33723": "IPTC/NAA",
205
+ "33550": "ModelPixelScaleTag",
206
+ "33920": "IntergraphMatrixTag",
207
+ "33922": "ModelTiepointTag",
208
+ "34016": "Site",
209
+ "34017": "ColorSequence",
210
+ "34018": "IT8Header",
211
+ "34019": "RasterPadding",
212
+ "34020": "BitsPerRunLength",
213
+ "34021": "BitsPerExtendedRunLength",
214
+ "34022": "ColorTable",
215
+ "34023": "ImageColorIndicator",
216
+ "34024": "BackgroundColorIndicator",
217
+ "34025": "ImageColorValue",
218
+ "34026": "BackgroundColorValue",
219
+ "34027": "PixelInensityRange",
220
+ "34028": "TransparencyIndicator",
221
+ "34029": "ColorCharacterization",
222
+ "34030": "HCUsage",
223
+ "34264": "ModelTransformationTag",
224
+ "34377": "PhotoshopImageResources",
225
+ "34665": "ExifIFD",
226
+ "34675": "InterColourProfile",
227
+ "34732": "ImageLayer",
228
+ "34735": "GeoKeyDirectoryTag",
229
+ "34736": "GeoDoubleParamsTag",
230
+ "34737": "GeoAsciiParamsTag",
231
+ "34850": "ExposureProgram",
232
+ "34852": "SpectralSensitivity",
233
+ "34853": "GPSInfo",
234
+ "34855": "ISOSpeedRatings",
235
+ "34856": "OECF",
236
+ "34857": "Interlace",
237
+ "34858": "TimeZoneOffset",
238
+ "34859": "SelfTimerMode",
239
+ "34908": "FaxRecvParams",
240
+ "34909": "FaxSubAddress",
241
+ "34910": "FaxRecvTime",
242
+ "36867": "DateTimeOriginal",
243
+ "37122": "CompressedBitsPerPixel",
244
+ "37377": "ShutterSpeedValue",
245
+ "37378": "ApertureValue",
246
+ "37379": "BrightnessValue",
247
+ "37380": "ExposureBiasValue",
248
+ "37381": "MaxApertureValue",
249
+ "37382": "SubjectDistance",
250
+ "37383": "MeteringMode",
251
+ "37384": "LightSource",
252
+ "37385": "Flash",
253
+ "37386": "FocalLength",
254
+ "37387": "FlashEnergy",
255
+ "37388": "SpatialFrequencyResponse",
256
+ "37389": "Noise",
257
+ "37390": "FocalPlaneXResolution",
258
+ "37391": "FocalPlaneYResolution",
259
+ "37392": "FocalPlaneResolutionUnit",
260
+ "37393": "ImageNumber",
261
+ "37394": "SecurityClassification",
262
+ "37395": "ImageHistory",
263
+ "37396": "SubjectLocation",
264
+ "37397": "ExposureIndex",
265
+ "37398": "TIFF/EPStandardID",
266
+ "37399": "SensingMethod",
267
+ "37439": "StoNits",
268
+ "37724": "ImageSourceData",
269
+ "40091": "XPTitle",
270
+ "40092": "XPComment",
271
+ "40093": "XPAuthor",
272
+ "40094": "XPKeywords",
273
+ "40095": "XPSubject",
274
+ "40965": "InteroperabilityIFD",
275
+ "41988": "DigitalZoomRatio",
276
+ "42016": "ImageUniqueID",
277
+ "50255": "PhotoshopAnnotations",
278
+ "50706": "DNGVersion",
279
+ "50707": "DNGBackwardVersion",
280
+ "50708": "UniqueCameraModel",
281
+ "50709": "LocalizedCameraModel",
282
+ "50710": "CFAPlaneColor",
283
+ "50711": "CFALayout",
284
+ "50712": "LinearizationTable",
285
+ "50713": "BlackLevelRepeatDim",
286
+ "50714": "BlackLevel",
287
+ "50715": "BlackLevelDeltaH",
288
+ "50716": "BlackLevelDeltaV",
289
+ "50717": "WhiteLevel",
290
+ "50718": "DefaultScale",
291
+ "50719": "DefaultCropOrigin",
292
+ "50720": "DefaultCropSize",
293
+ "50721": "ColorMatrix1",
294
+ "50722": "ColorMatrix2",
295
+ "50723": "CameraCalibration1",
296
+ "50724": "CameraCalibration2",
297
+ "50725": "ReductionMatrix1",
298
+ "50726": "ReductionMatrix2",
299
+ "50727": "AnalogBalnace",
300
+ "50728": "AsShortNeutral",
301
+ "50729": "AsShortWhiteXY",
302
+ "50730": "BaselineExposure",
303
+ "50731": "BaselineNoise",
304
+ "50732": "BaselineSharpness",
305
+ "50733": "BayerGreenSplit",
306
+ "50734": "LinearResponseLimit",
307
+ "50735": "CameraSerialNumber",
308
+ "50736": "LensInfo",
309
+ "50737": "ChromaBlurRadius",
310
+ "50738": "AntiAliasStrength",
311
+ "50740": "DNGPrivateData",
312
+ "50741": "MakerNoteSafety",
313
+ "50778": "CalibrationIlluminant1",
314
+ "50779": "CalibrationIlluminant2",
315
+ "50780": "BestQualityScale",
316
+ "59932": "Padding"
317
+ };
318
+
319
+ const EXIFNamesInfo = {
320
+ "33434": "ExposureTime",
321
+ "33437": "FNumber",
322
+ "34850": "ExposureProgram",
323
+ "34852": "SpectralSensitibity",
324
+ "34855": "ISOSpeedRatings",
325
+ "34856": "OECF",
326
+ "36864": "ExifVersion",
327
+ "36867": "DateTimeOriginal",
328
+ "36868": "DateTimeDigitized",
329
+ "36880": "OffsetTime",
330
+ "36881": "OffsetTimeOriginal",
331
+ "36882": "OffsetTimeDigitized",
332
+ "37121": "ComponentsConfiguration",
333
+ "37122": "CompressedBitsPerPixel",
334
+ "37377": "ShutterSpeedValue",
335
+ "37378": "ApertureValue",
336
+ "37379": "BrightnessValue",
337
+ "37380": "ExposureBiasValue",
338
+ "37381": "MaxApertureValue",
339
+ "37382": "SubjectDistance",
340
+ "37383": "MeteringMode",
341
+ "37384": "LightSource",
342
+ "37385": "Flash",
343
+ "37386": "FocalLength",
344
+ "37396": "SubjectArea",
345
+ "37500": "MakerNote",
346
+ "37510": "UserComment",
347
+ "37520": "SubSecTime",
348
+ "37521": "SubSecTimeOriginal",
349
+ "37522": "SubSecTimeDigitized",
350
+ "37890": "Pressure", //hPa
351
+ "37891": "WaterDepth", //m
352
+ "37892": "Acceleration", //mGal
353
+ "37893": "CameraElevationAngle",
354
+ "40960": "FlashpixVersion",
355
+ "40961": "ColorSpace",
356
+ "40962": "PixelXDimension",
357
+ "40963": "PixelYDimension",
358
+ "40964": "RelatedSoundFile",
359
+ "40965": "InteroperabilityIFD",
360
+ "41483": "FlashEnergy",
361
+ "41484": "SpatialFrequencyResponse",
362
+ "41486": "FocalPlaneXResolution",
363
+ "41487": "FocalPlaneYResolution",
364
+ "41488": "FocalPlaneResolutionUnit",
365
+ "41492": "SubjectLocation",
366
+ "41493": "ExposureIndex",
367
+ "41495": "SensingMethod",
368
+ "41728": "FileSource",
369
+ "41729": "SceneType",
370
+ "41730": "CFAPattern",
371
+ "41985": "CustomRendered",
372
+ "41986": "ExposureMode",
373
+ "41987": "WhiteBalance",
374
+ "41988": "DigitalZoomRatio",
375
+ "41989": "FocalLengthIn35mmFilm",
376
+ "41990": "SceneCaptureType",
377
+ "41991": "GainControl",
378
+ "41992": "Contrast",
379
+ "41993": "Saturation",
380
+ "41994": "Sharpness",
381
+ "41995": "DeviceSettingDescription",
382
+ "41996": "SubjectDistanceRange",
383
+ "42016": "ImageUniqueID",
384
+ "42032": "CameraOwnerName",
385
+ "42033": "BodySerialNumber",
386
+ "42034": "LensSpecification",
387
+ "42035": "LensMake",
388
+ "42036": "LensModel",
389
+ "42037": "LensSerialNumber",
390
+ "42080": "CompositeImage",
391
+ "42081": "SourceImageNumberOfCompositeImage",
392
+ "42082": "SourceExposureTimesOfCompositeImage",
393
+ "59932": "Padding",
394
+ "59933": "OffsetSchema"
395
+ };
396
+
397
+ const EXIFNamesGPS = {
398
+ "0": "GPSVersionID",
399
+ "1": "GPSLatitudeRef",
400
+ "2": "GPSLatitude",
401
+ "3": "GPSLongitudeRef",
402
+ "4": "GPSLongitude",
403
+ "5": "GPSAltitudeRef",
404
+ "6": "GPSAltitude",
405
+ "7": "GPSTimeStamp",
406
+ "8": "GPSSatellites",
407
+ "9": "GPSStatus",
408
+ "10": "GPSMeasureMode",
409
+ "11": "GPSDOP",
410
+ "12": "GPSSpeedRef",
411
+ "13": "GPSSpeed",
412
+ "14": "GPSTrackRef",
413
+ "15": "GPSTrack",
414
+ "16": "GPSImgDirectionRef",
415
+ "17": "GPSImgDirection",
416
+ "18": "GPSMapDatum",
417
+ "19": "GPSDestLatitudeRef",
418
+ "20": "GPSDestLatitude",
419
+ "21": "GPSDestLongitudeRef",
420
+ "22": "GPSDestLongitude",
421
+ "23": "GPSDestBearingRef",
422
+ "24": "GPSDestBearing",
423
+ "25": "GPSDestDistanceRef",
424
+ "26": "GPSDestDistance",
425
+ "27": "GPSProcessingMethod",
426
+ "28": "GPSAreaInformation",
427
+ "29": "GPSDateStamp",
428
+ "30": "GPSDifferential",
429
+ "31": "GPSHPositioningError"
430
+ };
431
+
432
+ const EXIFNamesPanasonic = {
433
+ "1": "Quality",
434
+ "2": "FirmwareVersion",
435
+ "3": "WhiteBalance",
436
+ "7": "FocusMode",
437
+ "15": "AFMode",
438
+ "26": "ImageStabilization",
439
+ "28": "Macro",
440
+ "31": "ShootingMode",
441
+ "32": "Audio",
442
+ "36": "FlashBias",
443
+ "37": "InternalSerialNumber",
444
+ "38": "ExifVersion",
445
+ "40": "ColorEffect",
446
+ "41": "TimeSincePowerOn",
447
+ "42": "BurstMode",
448
+ "43": "SequenceNumber",
449
+ "44": "Contrast",
450
+ "45": "NoiseReduction",
451
+ "46": "SelfTimer",
452
+ "48": "Rotation",
453
+ "49": "AFAssistLamp",
454
+ "50": "ColorMode",
455
+ "51": "BabyAge1",
456
+ "52": "OpticalZoomMode",
457
+ "53": "ConversionLens",
458
+ "54": "TravelDay",
459
+ "57": "Contrast",
460
+ "58": "WorldTimeLocation",
461
+ "59": "TestStamp1",
462
+ "60": "ProgramISO",
463
+ "61": "AdvancedSceneType",
464
+ "62": "TextStampe2",
465
+ "63": "FacesDetected",
466
+ "64": "Saturation",
467
+ "65": "Sharpness",
468
+ "68": "ColorTempKelvin",
469
+ "69": "BracketSettings",
470
+ "70": "WBAdjustAB",
471
+ "71": "WBAdjustGM",
472
+ "72": "FlashCurtain",
473
+ "73": "LongShutterNoiseReduction",
474
+ "75": "ImageWidth",
475
+ "76": "ImageHeight",
476
+ "77": "AFPointPosition",
477
+ "78": "FaceDetInfo",
478
+ "81": "LensType",
479
+ "82": "LensSerialNumber",
480
+ "83": "AccessoryTyp",
481
+ "84": "AccessorySerialNumber",
482
+ "96": "LensFirmwareVersion",
483
+ "97": "FaceRecInfo",
484
+ "101": "Title",
485
+ "102": "BabyName",
486
+ "103": "Location",
487
+ "105": "Country",
488
+ "107": "State",
489
+ "109": "City",
490
+ "111": "Landmark",
491
+ "112": "IntelligentResolution",
492
+ "119": "BurstSpeed",
493
+ "121": "IntelligentDRange",
494
+ "124": "ClearRetouch",
495
+ "128": "City2",
496
+ "137": "PhotoStyle",
497
+ "138": "ShadingCompensation",
498
+ "140": "AccelerometerZ",
499
+ "141": "AccelerometerX",
500
+ "142": "AccelerometerY",
501
+ "143": "CameraOrientation",
502
+ "144": "RollAngle",
503
+ "145": "PitchAngle",
504
+ "147": "SweepPanoramaDirection",
505
+ "148": "PanoramaFieldOfView",
506
+ "150": "TimerRecording",
507
+ "157": "InternalNDFilter",
508
+ "158": "HDR",
509
+ "159": "ShutterType",
510
+ "163": "ClearRetouchValue",
511
+ "171": "TouchAE",
512
+ "32768": "MakerNoteVersion",
513
+ "32769": "SceneMode",
514
+ "32772": "WBRedLevel",
515
+ "32773": "WBGreenLevel",
516
+ "32774": "WBBlueLevel",
517
+ "32775": "FlashFired",
518
+ "32776": "TextStamp3",
519
+ "32777": "TextStamp4",
520
+ "32784": "babyAge2"
521
+ };
522
+
523
+ const EXIFNamesCanon = {
524
+ "1": "CanonCameraSettings",
525
+ "2": "CanonFocalLength",
526
+ "3": "CanonFlashInfo",
527
+ "4": "CanonShotInfo",
528
+ "5": "CanonPanorama",
529
+ "6": "CanonImageType",
530
+ "7": "CanonFirmwareVersion",
531
+ "8": "FileNumber",
532
+ "9": "OwnerName",
533
+ "10": "UnknownD30",
534
+ "12": "SerialNumber",
535
+ "13": "CanonCameraInfo",
536
+ "14": "CanonFileLength",
537
+ "15": "CustomFunctions",
538
+ "16": "CanonModelID",
539
+ "17": "MovieInfo",
540
+ "18": "CanonAFInfo",
541
+ "19": "ThumbnailImageValidArea",
542
+ "21": "SerialNumberFormat",
543
+ "26": "SuperMacro",
544
+ "28": "DateStampMode",
545
+ "29": "MyColors",
546
+ "30": "FirmwareRevision",
547
+ "35": "FaceDetect1",
548
+ "36": "FaceDetect2",
549
+ "37": "Categories",
550
+ "38": "CanonAFInfo2",
551
+ "39": "ContrastInfo",
552
+ "40": "ImageUniqueID",
553
+ "47": "FaceDetect3",
554
+ "53": "TimeInfo",
555
+ "56": "BatteryType",
556
+ "60": "AFInfo3",
557
+ "129": "RawDataOffset",
558
+ "131": "OriginalDecisionData",
559
+ "144": "CustomFunctions1D",
560
+ "145": "PersonalFunctions",
561
+ "146": "PersonalFunctionValues",
562
+ "147": "CanonFileInfo",
563
+ "148": "AFPointsInFocus1D",
564
+ "149": "LensModel",
565
+ "150": "InternalSerialNumber",
566
+ "151": "DustRemovalData",
567
+ "152": "CropInfo",
568
+ "153": "CustomFunctions2",
569
+ "154": "AspectInfo",
570
+ "160": "ProcessingInfo",
571
+ "161": "ToneCurveTable",
572
+ "162": "SharpnessTable",
573
+ "163": "SharpnessFreqTable",
574
+ "164": "WhiteBalanceTable",
575
+ "169": "ColorBalance",
576
+ "170": "MeasuredColor",
577
+ "174": "ColorTemperature",
578
+ "176": "CanonFlags",
579
+ "177": "ModifiedInfo",
580
+ "178": "ToneCurveMatching",
581
+ "179": "WhiteBalanceMatching",
582
+ "180": "ColorSpace",
583
+ "182": "PreviewImageInfo",
584
+ "208": "VROffset",
585
+ "224": "SensorInfo",
586
+ "16385": "ColorBalance", //0x4001
587
+ "16386": "UnknownBlock1", //0x4002
588
+ "16387": "ColorInfo", //0x4003
589
+ "16389": "Flavor", //0x4005
590
+ "16392": "PictureStyleUserDef", //0x4008
591
+ "16393": "PictureStylePC", //0x4009
592
+ "16400": "CustomPictureStyleFileName", //0x4010
593
+ "16403": "AFMicroAdj", //0x4013
594
+ "16405": "VignettingCorr", //0x4015
595
+ "16406": "VignettingCorr2", //0x4016
596
+ "16408": "LightingOpt", //0x4018
597
+ "16409": "LensInfo", //0x4019
598
+ "16416": "AmbienceInfo", //0x4020
599
+ "16417": "MultiExp", //0x4021
600
+ "16420": "FilterInfo", //0x4024
601
+ "16421": "HDRInfo", //0x4025
602
+ "16424": "AFConfig" //0x4028
603
+ };
604
+
605
+ const EXIFNamesOlympus = {
606
+ "0": "MakerNoteVersion", //0x0000
607
+ "1": "MinoltaCameraSettingsOld", //0x0001
608
+ "3": "MinoltaCameraSettings", //0x0003
609
+ "64": "CompressedImageSize", //0x0040
610
+ "129": "PreviewImageData", //0x0081
611
+ "136": "PreviewImageStart", //0x0088
612
+ "137": "PreviewImageLength", //0x0089
613
+ "256": "ThumbnailImage", //0x0100
614
+ "260": "BodyFirmwareVersion", //0x0104
615
+ "512": "SpecialMode", //0x0200
616
+ "513": "Quality", //0x0201
617
+ "514": "Macro", //0x0202
618
+ "515": "BWMode", //0x0203
619
+ "516": "DigitalZoom", //0x0204
620
+ "517": "FocalPlaneDiagonal", //0x0205
621
+ "518": "LensDistortionParmas", //0x0206
622
+ "519": "CameraType", //0x0207
623
+ "520": "CameraInfo", //0x0208
624
+ "521": "CameraID", //0x0209
625
+ "523": "EpsonImageWidth", //0x020b
626
+ "524": "EpsonImageHeight", //0x020c
627
+ "525": "EpsonSoftware", //0x020d
628
+ "640": "PreviewImage", //0x0280
629
+ "768": "PreCaptureFrames", //0x0300
630
+ "769": "WhiteBoard", //0x0301
631
+ "770": "OneTouchWB", //0x0302
632
+ "771": "WhiteBalanceBracket", //0x0303
633
+ "772": "WhiteBalanceBias", //0x0304
634
+ "1025": "BlackLevel", //0x0401
635
+ "1027": "SceneMode", //0x0403
636
+ "1028": "SerialNumber", //0x0404
637
+ "1029": "Firmware", //0x0405
638
+ "3584": "PrintIM", //0x0e00
639
+ "3840": "DataDump", //0x0f00
640
+ "3841": "DataDump2", //0x0f01
641
+ "3844": "ZoomedPreviewStart", //0x0f04
642
+ "3845": "ZoomedPreviewLength", //0x0f05
643
+ "3846": "ZoomedPreviewSize", //0x0f06
644
+ "4096": "ShutterSpeedValue", //0x1000
645
+ "4097": "ISOValue", //0x1001
646
+ "4098": "ApertureValue", //0x1002
647
+ "4099": "BrightnessValue", //0x1003
648
+ "4100": "FlashMode", //0x1004
649
+ "4101": "FlashDevice", //0x1005
650
+ "4102": "ExposureCompensation", //0x1006
651
+ "4103": "SensorTemperature", //0x1007
652
+ "4104": "LensTemperature", //0x1008
653
+ "4105": "LightCondition", //0x1009
654
+ "4106": "FocusRange", //0x100a
655
+ "4107": "FocusMode", //0x100b
656
+ "4108": "ManualFocusDistance", //0x100c
657
+ "4109": "ZoomStepCount", //0x100d
658
+ "4110": "FocusStepCount", //0x100e
659
+ "4111": "Sharpness", //0x100f
660
+ "4112": "FlashChargeLevel", //0x1010
661
+ "4113": "ColorMatrix", //0x1011
662
+ "4114": "BlackLevel", //0x1012
663
+ "4115": "ColorTemperatureBG", //0x1013
664
+ "4116": "ColorTemperatureRG", //0x1014
665
+ "4117": "WBMode", //0x1015
666
+ "4119": "RedBalance", //0x1017
667
+ "4120": "BlueBalance", //0x1018
668
+ "4121": "ColorMatrixNumber", //0x1019
669
+ "4122": "SerialNumber", //0x101a
670
+ "4123": "ExternalFlashAE1_0", //0x101b
671
+ "4124": "ExternalFlashAE2_0", //0x101c
672
+ "4125": "InternalFlashAE1_0", //0x101d
673
+ "4126": "InternalFlashAE2_0", //0x101e
674
+ "4127": "ExternalFlashAE1", //0x101f
675
+ "4128": "ExternalFlashAE2", //0x1020
676
+ "4129": "InternalFlashAE1", //0x1021
677
+ "4130": "InternalFlashAE2", //0x1022
678
+ "4131": "FlashExposureComp", //0x1023
679
+ "4132": "InternalFlashTable", //0x1024
680
+ "4133": "ExternalFlashGValue", //0x1025
681
+ "4134": "ExternalFlashBounce", //0x1026
682
+ "4135": "ExternalFlashZoom", //0x1027
683
+ "4136": "ExternalFlashMode", //0x1028
684
+ "4137": "Contrast", //0x1029
685
+ "4138": "SharpnessFactor", //0x102a
686
+ "4139": "ColorControl", //0x102b
687
+ "4140": "ValidBits", //0x102c
688
+ "4141": "CoringFilter", //0x102d
689
+ "4142": "OlympusImageWidth", //0x102e
690
+ "4143": "OlympusImageHeight", //0x102f
691
+ "4144": "SceneDetect", //0x1030
692
+ "4145": "SceneArea", //0x1031
693
+ "4147": "SceneDetectData", //0x1033
694
+ "4148": "CompressionRatio", //0x1034
695
+ "4149": "PreviewImageValid", //0x1035
696
+ "4150": "PreviewImageStart", //0x1036
697
+ "4151": "PreviewImageLength", //0x1037
698
+ "4152": "AFResult", //0x1038
699
+ "4153": "CCDScanMode", //0x1039
700
+ "4154": "NoiseReduction", //0x103a
701
+ "4155": "FocusStepInfinity", //0x103b
702
+ "4156": "FocusStepNear", //0x103c
703
+ "4157": "LightValueCenter", //0x103d
704
+ "4158": "LightValuePeriphery", //0x103e
705
+ "4159": "FieldCount", //0x103f
706
+ "8208": "Equipment", //0x2010
707
+ "8224": "CameraSettings", //0x2020
708
+ "8240": "RawDevelopment", //0x2030
709
+ "8241": "RawDev2", //0x2031
710
+ "8256": "ImageProcessing", //0x2040
711
+ "8272": "FocusInfo", //0x2050
712
+ "8448": "Olympus2100", //0x2100
713
+ "8704": "Olympus2200", //0x2200
714
+ "8960": "Olympus2300", //0x2300
715
+ "9216": "Olympus2400", //0x2400
716
+ "9472": "Olympus2500", //0x2500
717
+ "9728": "Olympus2600", //0x2600
718
+ "9984": "Olympus2700", //0x2700
719
+ "10240": "Olympus2800", //0x2800
720
+ "10496": "Olympus2900", //0x2900
721
+ "12288": "RawInfo", //0x3000
722
+ "16384": "MainInfo", //0x4000
723
+ "20480": "UnknownInfo" //0x5000
724
+ };
725
+
726
+ const EXIFNamesOlympus2010 = {
727
+ "0x0000": "EquipmentVersion",
728
+ "0x0100": "CameraType2",
729
+ "0x0101": "SerialNumber",
730
+ "0x0102": "InternalSerialNumber",
731
+ "0x0103": "FocalPlaneDiagonal",
732
+ "0x0104": "BodyFirmwareVersion",
733
+ "0x0201": "LensType",
734
+ "0x0202": "LensSerialNumber",
735
+ "0x0203": "LensModel",
736
+ "0x0204": "LensFirmwareVersion",
737
+ "0x0205": "MaxApertureAtMinFocal",
738
+ "0x0206": "MaxApertureAtMaxFocal",
739
+ "0x0207": "MinFocalLength",
740
+ "0x0208": "MaxFocalLength",
741
+ "0x020a": "MaxAperture",
742
+ "0x020b": "LensProperties",
743
+ "0x0301": "Extender",
744
+ "0x0302": "ExtenderSerialNumber",
745
+ "0x0303": "ExtenderModel",
746
+ "0x0304": "ExtenderFirmwareVersion",
747
+ "0x0403": "ConversionLens",
748
+ "0x1000": "FlashType",
749
+ "0x1001": "FlashModel",
750
+ "0x1002": "FlashFirmwareVersion",
751
+ "0x1003": "FlashSerialNumber"
752
+ };
753
+
754
+ const EXIFNamesOlympus2020 = {
755
+ "0x0000": "CameraSettingsVersion",
756
+ "0x0100": "PreviewImageValid",
757
+ "0x0101": "PreviewImageStart",
758
+ "0x0102": "PreviewImageLength",
759
+ "0x0200": "ExposureMode",
760
+ "0x0201": "AELock",
761
+ "0x0202": "MeteringMode",
762
+ "0x0203": "ExposureShift",
763
+ "0x0204": "NDFilter",
764
+ "0x0300": "MacroMode",
765
+ "0x0301": "FocusMode",
766
+ "0x0302": "FocusProcess",
767
+ "0x0303": "AFSearch",
768
+ "0x0304": "AFAreas",
769
+ "0x0305": "AFPointSelected",
770
+ "0x0306": "AFFineTune",
771
+ "0x0307": "AFFineTuneAdj",
772
+ "0x0400": "FlashMode",
773
+ "0x0401": "FlashExposureComp",
774
+ "0x0403": "FlashRemoteControl",
775
+ "0x0404": "FlashControlMode",
776
+ "0x0405": "FlashIntensity",
777
+ "0x0406": "ManualFlashStrength",
778
+ "0x0500": "WhiteBalance2",
779
+ "0x0501": "WhiteBalanceTemperature",
780
+ "0x0502": "WhiteBalanceBracket",
781
+ "0x0503": "CustomSaturation",
782
+ "0x0504": "ModifiedSaturation",
783
+ "0x0505": "ContrastSetting",
784
+ "0x0506": "SharpnessSetting",
785
+ "0x0507": "ColorSpace",
786
+ "0x0509": "SceneMode",
787
+ "0x050a": "NoiseReduction",
788
+ "0x050b": "DistortionCorrection",
789
+ "0x050c": "ShadingCompensation",
790
+ "0x050d": "CompressionFactor",
791
+ "0x050f": "Gradation",
792
+ "0x0520": "PictureMode",
793
+ "0x0521": "PictureModeSaturation",
794
+ "0x0522": "PictureModeHue",
795
+ "0x0523": "PictureModeContrast",
796
+ "0x0524": "PictureModeSharpness",
797
+ "0x0525": "PictureModeBWFilter",
798
+ "0x0526": "PictureModeTone",
799
+ "0x0527": "NoiseFilter",
800
+ "0x0529": "ArtFilter",
801
+ "0x052c": "MagicFilter",
802
+ "0x052d": "PictureModeEffect",
803
+ "0x052e": "ToneLevel",
804
+ "0x052f": "ArtFilterEffect",
805
+ "0x0532": "ColorCreatorEffect",
806
+ "0x0537": "MonochromeProfileSettings",
807
+ "0x0538": "FilmGrainEffect",
808
+ "0x0539": "ColorProfileSettings",
809
+ "0x053a": "MonochromeVignetting",
810
+ "0x053b": "MonochromeColor",
811
+ "0x0600": "DriveMode",
812
+ "0x0601": "PanoramaMode",
813
+ "0x0603": "ImageQuality2",
814
+ "0x0604": "ImageStabilization",
815
+ "0x0804": "StackedImage",
816
+ "0x0900": "ManometerPressure",
817
+ "0x0901": "ManometerReading",
818
+ "0x0902": "ExtendedWBDetect",
819
+ "0x0903": "RollAngle",
820
+ "0x0904": "PitchAngle",
821
+ "0x0908": "DateTimeUTC"
822
+ };
823
+
824
+ const EXIFNamesOlympus2030 = {
825
+ "0x0000": "RawDevVersion",
826
+ "0x0100": "RawDevExposureBiasValue",
827
+ "0x0101": "RawDevWhiteBalanceValue",
828
+ "0x0102": "RawDevWBFineAdjustment",
829
+ "0x0103": "RawDevGrayPoint",
830
+ "0x0104": "RawDevSaturationEmphasis",
831
+ "0x0105": "RawDevMemoryColorEmphasis",
832
+ "0x0106": "RawDevContrastValue",
833
+ "0x0107": "RawDevSharpnessValue",
834
+ "0x0108": "RawDevColorSpace",
835
+ "0x0109": "RawDevEngine",
836
+ "0x010a": "RawDevNoiseReduction",
837
+ "0x010b": "RawDevEditStatus",
838
+ "0x010c": "RawDevSettings"
839
+ };
840
+
841
+ const EXIFNamesOlympus2040 = {
842
+ "0x0000": "ImageProcessingVersion",
843
+ "0x0100": "WB_RBLevels",
844
+ "0x0102": "WB_RBLevels3000K",
845
+ "0x0103": "WB_RBLevels3300K",
846
+ "0x0104": "WB_RBLevels3600K",
847
+ "0x0105": "WB_RBLevels3900K",
848
+ "0x0106": "WB_RBLevels4000K",
849
+ "0x0107": "WB_RBLevels4300K",
850
+ "0x0108": "WB_RBLevels4500K",
851
+ "0x0109": "WB_RBLevels4800K",
852
+ "0x010a": "WB_RBLevels5300K",
853
+ "0x010b": "WB_RBLevels6000K",
854
+ "0x010c": "WB_RBLevels6600K",
855
+ "0x010d": "WB_RBLevels7500K",
856
+ "0x010e": "WB_RBLevelsCWB1",
857
+ "0x010f": "WB_RBLevelsCWB2",
858
+ "0x0110": "WB_RBLevelsCWB3",
859
+ "0x0111": "WB_RBLevelsCWB4",
860
+ "0x0113": "WB_GLevel3000K",
861
+ "0x0114": "WB_GLevel3300K",
862
+ "0x0115": "WB_GLevel3600K",
863
+ "0x0116": "WB_GLevel3900K",
864
+ "0x0117": "WB_GLevel4000K",
865
+ "0x0118": "WB_GLevel4300K",
866
+ "0x0119": "WB_GLevel4500K",
867
+ "0x011a": "WB_GLevel4800K",
868
+ "0x011b": "WB_GLevel5300K",
869
+ "0x011c": "WB_GLevel6000K",
870
+ "0x011d": "WB_GLevel6600K",
871
+ "0x011e": "WB_GLevel7500K",
872
+ "0x011f": "WB_GLevel",
873
+ "0x0200": "ColorMatrix",
874
+ "0x0300": "Enhancer",
875
+ "0x0301": "EnhancerValues",
876
+ "0x0310": "CoringFilter",
877
+ "0x0311": "CoringValues",
878
+ "0x0600": "BlackLevel2",
879
+ "0x0610": "GainBase",
880
+ "0x0611": "ValidBits",
881
+ "0x0612": "CropLeft",
882
+ "0x0613": "CropTop",
883
+ "0x0614": "CropWidth",
884
+ "0x0615": "CropHeight",
885
+ "0x0635": "UnknownBlock1",
886
+ "0x0636": "UnknownBlock2",
887
+ "0x0805": "SensorCalibration",
888
+ "0x1010": "NoiseReduction2",
889
+ "0x1011": "DistortionCorrection2",
890
+ "0x1012": "ShadingCompensation2",
891
+ "0x101c": "MultipleExposureMode",
892
+ "0x1103": "UnknownBlock3",
893
+ "0x1104": "UnknownBlock4",
894
+ "0x1112": "AspectRatio",
895
+ "0x1113": "AspectFrame",
896
+ "0x1200": "FacesDetected",
897
+ "0x1201": "FaceDetectArea",
898
+ "0x1202": "MaxFaces",
899
+ "0x1203": "FaceDetectFrameSize",
900
+ "0x1207": "FaceDetectFrameCrop",
901
+ "0x1306": "CameraTemperature",
902
+ "0x1900": "KeystoneCompensation",
903
+ "0x1901": "KeystoneDirection",
904
+ "0x1906": "KeystoneValue"
905
+ };
906
+
907
+ const EXIFNamesOlympus2050 = {
908
+ "0x0000": "FocusInfoVersion",
909
+ "0x0209": "AutoFocus",
910
+ "0x0210": "SceneDetect",
911
+ "0x0211": "SceneArea",
912
+ "0x0212": "SceneDetectData",
913
+ "0x0300": "ZoomStepCount",
914
+ "0x0301": "FocusStepCount",
915
+ "0x0303": "FocusStepInfinity",
916
+ "0x0304": "FocusStepNear",
917
+ "0x0305": "FocusDistance",
918
+ "0x0308": "AFPoint",
919
+ "0x0328": "AFInfo",
920
+ "0x1201": "ExternalFlash",
921
+ "0x1203": "ExternalFlashGuideNumber",
922
+ "0x1204": "ExternalFlashBounce",
923
+ "0x1205": "ExternalFlashZoom",
924
+ "0x1208": "InternalFlash",
925
+ "0x1209": "ManualFlash",
926
+ "0x120a": "MacroLED",
927
+ "0x1500": "SensorTemperature",
928
+ "0x1600": "ImageStabilization"
929
+ };
930
+
931
+ const EXIFNamesCasio1 = {
932
+ "1": "RecordingMode",
933
+ "2": "Quality",
934
+ "3": "FocusingMode",
935
+ "4": "FlashMode",
936
+ "5": "FlashIntensity",
937
+ "6": "ObjectDistance",
938
+ "7": "WhiteBalance",
939
+ "10": "DigitalZoom",
940
+ "11": "Sharpness",
941
+ "12": "Contract",
942
+ "13": "Saturation",
943
+ "20": "CCDSensitivity"
944
+ };
945
+
946
+ const EXIFNamesCasio2 = {
947
+ "2": "PreviewThumbDimension",
948
+ "3": "PreviewThumbSize",
949
+ "4": "PreviewThumbOffset",
950
+ "8": "QualityMode",
951
+ "9": "ImageSize",
952
+ "13": "FocusMode",
953
+ "20": "IsoSensitivity",
954
+ "25": "WhiteBalance",
955
+ "29": "FocalLength",
956
+ "31": "Saturation",
957
+ "32": "Contrast",
958
+ "33": "Sharpness",
959
+ "3584": "PIM", //0x0E00
960
+ "8192": "CasioPreviewThumbnail", //0x2000
961
+ "8209": "WhiteBalanceBias", //0x2011
962
+ "8210": "WhiteBalance", //0x2012
963
+ "8226": "ObjectDistance", //0x2022
964
+ "8244": "FlashDistance", //0x2034
965
+ "12288": "RecordMode", //0x3000
966
+ "12289": "SelfTimer", //0x3001
967
+ "12290": "Quality", //0x3002
968
+ "12291": "FocusMode", //0x3003
969
+ "12294": "TimeZone", //0x3006
970
+ "12295": "BestshotMode", //0x3007
971
+ "12308": "CCDISOSensitivity", //0x3014
972
+ "12309": "ColourMode", //0x3015
973
+ "12310": "Enhancement", //0x3016
974
+ "12311": "Filter" //0x3017
975
+ };
976
+
977
+ const EXIFNamesFLIR = {
978
+ "1": "RTemp",
979
+ "2": "ATemp",
980
+ "3": "Emissivity",
981
+ "4": "IRWTemp",
982
+ "5": "CameraTemperatureRangeMax",
983
+ "6": "CameraTemperatureRangeMin",
984
+ "7": "Unknown",
985
+ "8": "Unknown",
986
+ "9": "Unknown",
987
+ "10": "Unknown",
988
+ "274": "Unknown"
989
+ };
990
+
991
+ const EXIFNamesNikon3 = {
992
+ "1": "Version",
993
+ "2": "ISOSpeed",
994
+ "3": "ColourMode",
995
+ "4": "Quality",
996
+ "5": "WhiteBalance",
997
+ "6": "Sharpening",
998
+ "7": "Focus",
999
+ "8": "FlashSetting",
1000
+ "9": "FlashDevice",
1001
+ "11": "WhiteBalanceBias",
1002
+ "12": "WB_RBLevels",
1003
+ "13": "ProgramShift",
1004
+ "14": "ExposureDiff",
1005
+ "15": "ISOSelection",
1006
+ "16": "DataDump",
1007
+ "17": "Preview",
1008
+ "18": "FlashComp",
1009
+ "19": "ISOSettings",
1010
+ "22": "ImageBoundary",
1011
+ "23": "FlashExposureComp",
1012
+ "24": "FlashBracketComp",
1013
+ "25": "ExposureBracketComp",
1014
+ "26": "ImageProcessing",
1015
+ "27": "CropHiSpeed",
1016
+ "28": "ExposureTuning",
1017
+ "29": "SerialNumber",
1018
+ "30": "ColorSpace",
1019
+ "31": "VRInfo",
1020
+ "32": "ImageAuthentication",
1021
+ "34": "ActiveDLighting",
1022
+ "35": "PictureControl",
1023
+ "36": "WorldTime",
1024
+ "37": "ISOInfo",
1025
+ "42": "VignetteControl",
1026
+ "52": "ShutterMode",
1027
+ "55": "MechanicalShutterCount",
1028
+ "128": "ImageAdjustment",
1029
+ "129": "ToneComp",
1030
+ "130": "AuxiliaryLens",
1031
+ "131": "LensType",
1032
+ "132": "Lens",
1033
+ "133": "FocusDistance",
1034
+ "134": "DigitalZoom",
1035
+ "135": "FlashMode",
1036
+ "136": "AFInfo",
1037
+ "137": "ShootingMode",
1038
+ "138": "AutoBracketRelease",
1039
+ "139": "LensFStops",
1040
+ "140": "ContrastCurve",
1041
+ "141": "ColorHue",
1042
+ "143": "SceneMode",
1043
+ "144": "LightSource",
1044
+ "145": "ShotInfo",
1045
+ "146": "HueAdjustment",
1046
+ "147": "NEFCompression",
1047
+ "148": "Saturation",
1048
+ "149": "NoiseReduction",
1049
+ "150": "LinearizationTable",
1050
+ "151": "ColorBalance",
1051
+ "152": "LensData",
1052
+ "153": "RawImageCenter",
1053
+ "154": "SensorPixelSize",
1054
+ "156": "SceneAssist",
1055
+ "158": "RetouchHistory",
1056
+ "160": "SerialNO",
1057
+ "162": "ImageDataSize",
1058
+ "165": "ImageCount",
1059
+ "166": "DeletedImageCount",
1060
+ "167": "ShutterCount",
1061
+ "168": "FlashInfo",
1062
+ "169": "ImageOptimisation",
1063
+ "170": "Saturation",
1064
+ "171": "VariProgram",
1065
+ "172": "ImageStabilization",
1066
+ "173": "AFResponse",
1067
+ "176": "MultiExposure",
1068
+ "177": "HighISONoiseReduction",
1069
+ "179": "ToningEffect",
1070
+ "183": "AFInfo2",
1071
+ "184": "FileInfo",
1072
+ "185": "AFTune",
1073
+ "195": "BarometerInfo",
1074
+ "3584": "PrintIM",
1075
+ "3585": "CaptureData",
1076
+ "3593": "CaptureVersion",
1077
+ "3598": "CaptureOffsets",
1078
+ "3600": "ScanIFD",
1079
+ "3613": "ICCProfile",
1080
+ "3614": "CaptureOutput"
1081
+ };
1082
+
1083
+ const EXIFNamesSanyo1 = {
1084
+ "0": "Unknown",
1085
+ "1": "Version",
1086
+ "136": "Thumbnail Offset", //0x0088
1087
+ "137": "Thumbnail Length", //0x0089
1088
+ "255": "Makernote Offset", //0x00FF
1089
+ "256": "Jpeg Thumbnail", //0x0100
1090
+ "512": "Special Mode", //0x0200
1091
+ "513": "Jpeg Quality", //0x0201
1092
+ "514": "Macro", //0x0202
1093
+ "515": "Sanyo-1-0x0203", //0x0203
1094
+ "516": "Digital Zoom", //0x0204
1095
+ "519": "Software Version", //0x0207
1096
+ "520": "Picture Info", //0x0208
1097
+ "521": "Camera ID", //0x0209
1098
+ "526": "Sequential Shot Method", //0x020E
1099
+ "527": "Wide Range", //0x020F
1100
+ "528": "Color Adjustment Mode", //0x0210
1101
+ "529": "Sanyo-1-0x0211", //0x0211
1102
+ "530": "Sanyo-1-0x0212", //0x0212
1103
+ "531": "Quick Shot", //0x0213
1104
+ "532": "Self Timer", //0x0214
1105
+ "533": "Sanyo-1-0x0215", //0x0215
1106
+ "534": "Voice Memo", //0x0216
1107
+ "535": "Record Shutter Release", //0x0217
1108
+ "536": "Flicker Reduce", //0x0218
1109
+ "537": "Optical Zoom", //0x0219
1110
+ "538": "Sanyo-1-0x021a", //0x021A
1111
+ "539": "Digital Zoom", //0x021B
1112
+ "540": "Sanyo-1-0x021c", //0x021C
1113
+ "541": "Light Source Special", //0x021D
1114
+ "542": "Resaved", //0x021E
1115
+ "543": "Scene Select", //0x021F
1116
+ "544": "Sanyo-1-0x0220", //0x0220
1117
+ "545": "Sanyo-1-0x0221", //0x0221
1118
+ "546": "Sanyo-1-0x0222", //0x0222
1119
+ "547": "Manual Focal Distance", //0x0223
1120
+ "548": "Sequential Shot Interval", //0x0224
1121
+ "549": "Flash Mode", //0x0225
1122
+ "550": "Sanyo-1-0x0226", //0x0226
1123
+ "768": "Sanyo-1-0x0300", //0x0300
1124
+ "3584": "Print IM Data", //0x0E00
1125
+ "3840": "Data Dump" //0x0F00
1126
+ };
1127
+
1128
+ const EXIFNamesApple = {
1129
+ "1": "MakerNoteVersion",
1130
+ "2": "AEMatrix?",
1131
+ "3": "RunTime",
1132
+ "4": "AEStable",
1133
+ "5": "AETarget",
1134
+ "6": "AEAverage",
1135
+ "7": "AFStable",
1136
+ "8": "FocusAccelerometerVector",
1137
+ "9": "SISMethod",
1138
+ "10": "HDRMethod",
1139
+ "11": "BurstUUID",
1140
+ "12": "SphereHealthTrackingError",
1141
+ "13": "SphereHealthAverageCurrent",
1142
+ "14": "SphereMotionDataStatus",
1143
+ "15": "OISMode",
1144
+ "16": "SphereStatus",
1145
+ "17": "AssetIdentifier",
1146
+ "18": "QRMOutputType",
1147
+ "19": "SphereExternalForceOffset",
1148
+ "20": "StillImageCaptureType",
1149
+ "21": "ImageGroupIdentifier",
1150
+ "22": "PhotosOriginatingSignature",
1151
+ "23": "LivePhotoVideoIndex",
1152
+ "24": "PhotosRenderOriginatingSignature",
1153
+ "25": "StillImageProcessingFlags",
1154
+ "26": "PhotoTranscodeQualityHint",
1155
+ "27": "PhotosRenderEffect",
1156
+ "28": "BracketedCaptureSequenceNumber",
1157
+ "29": "LuminanceNoiseAmplitude?",
1158
+ "30": "OriginatingAppID?",
1159
+ "31": "PhotosAppFeatureFlags",
1160
+ "32": "ImageCaptureRequestIdentifier",
1161
+ "33": "MeteorHeadroom",
1162
+ "34": "ARKitPhoto",
1163
+ "35": "AFPerformance",
1164
+ "36": "AFExternalOffset",
1165
+ "37": "StillImageSceneFlags",
1166
+ "38": "StillImageSNRType",
1167
+ "39": "StillImageSNR",
1168
+ "40": "UBMethod",
1169
+ "41": "SpatialOverCaptureGroupIdentifier",
1170
+ "42": "iCloudServerSoftwareVersionForDynamicallyGeneratedMedia",
1171
+ "43": "PhotoIdentifier",
1172
+ "44": "SpatialOverCaptureImageType",
1173
+ "45": "CCT",
1174
+ "46": "ApsMode",
1175
+ "47": "FocusPosition",
1176
+ "48": "MeteorPlusGainMap",
1177
+ "49": "StillImageProcessingHomography",
1178
+ "50": "IntelligentDistortionCorrection",
1179
+ "51": "NRFStatus",
1180
+ "52": "NRFInputBracketCount",
1181
+ "53": "NRFRegisteredBracketCount",
1182
+ "54": "LuxLevel",
1183
+ "55": "LastFocusingMethod",
1184
+ "56": "TimeOfFlightAssistedAutoFocusEstimatorMeasuredDepth",
1185
+ "57": "TimeOfFlightAssistedAutoFocusEstimatorROIType",
1186
+ "58": "NRFSRLStatus",
1187
+ "59": "SystemPressureLevel",
1188
+ "60": "CameraControlsStatisticsMaster",
1189
+ "61": "TimeOfFlightAssistedAutoFocusEstimatorSensorConfidence",
1190
+ "62": "ColorCorrectionMatrix?",
1191
+ "63": "GreenGhostMitigationStatus?",
1192
+ "64": "SemanticStyle",
1193
+ "65": "SemanticStyleKey_RenderingVersion",
1194
+ "66": "SemanticStyleKey_Preset",
1195
+ "67": "SemanticStyleKey_ToneBias",
1196
+ "68": "SemanticStyleKey_WarmthBias",
1197
+ "69": "FrontFacingCamera",
1198
+ "70": "TimeOfFlightAssistedAutoFocusEstimatorContainsBlindSpot",
1199
+ "71": "LeaderFollowerAutoFocusLeaderDepth",
1200
+ "72": "LeaderFollowerAutoFocusLeaderFocusMethod",
1201
+ "73": "LeaderFollowerAutoFocusLeaderConfidence",
1202
+ "74": "LeaderFollowerAutoFocusLeaderROIType",
1203
+ "75": "ZeroShutterLagFailureReason",
1204
+ "76": "TimeOfFlightAssistedAutoFocusEstimatorMSPMeasuredDepth",
1205
+ "77": "TimeOfFlightAssistedAutoFocusEstimatorMSPSensorConfidence",
1206
+ "78": "Camera"
1207
+ };
1208
+
1209
+ export class EXIFData
1210
+ {
1211
+ constructor(exifMaker)
1212
+ {
1213
+ this.exifMaker = exifMaker;
1214
+ this.exifMap = {};
1215
+ }
1216
+
1217
+ getEXIFMaker()
1218
+ {
1219
+ return this.exifMaker;
1220
+ }
1221
+
1222
+ clone()
1223
+ {
1224
+ let item;
1225
+ let i;
1226
+ let newExif = new EXIFData(this.exifMaker);
1227
+ for (i in this.exifMap)
1228
+ {
1229
+ item = this.exifMap[i];
1230
+ newExif.exifMap[i] = item.clone();
1231
+ }
1232
+ return newExif;
1233
+ }
1234
+
1235
+ addBytes(id, data)
1236
+ {
1237
+ this.exifMap[id] = new EXIFItem(id, EXIFType.Bytes, data);
1238
+ }
1239
+
1240
+ addString(id, data)
1241
+ {
1242
+ this.exifMap[id] = new EXIFItem(id, EXIFType.STRING, data);
1243
+ }
1244
+
1245
+ addUInt16(id, data)
1246
+ {
1247
+ this.exifMap[id] = new EXIFItem(id, EXIFType.UINT16, data);
1248
+ }
1249
+
1250
+ addUInt32(id, data)
1251
+ {
1252
+ this.exifMap[id] = new EXIFItem(id, EXIFType.UINT32, data);
1253
+ }
1254
+
1255
+ addInt16(id, data)
1256
+ {
1257
+ this.exifMap[id] = new EXIFItem(id, EXIFType.INT16, data);
1258
+ }
1259
+
1260
+ addInt32(id, data)
1261
+ {
1262
+ this.exifMap[id] = new EXIFItem(id, EXIFType.INT32, data);
1263
+ }
1264
+
1265
+ addRational(id, data)
1266
+ {
1267
+ this.exifMap[id] = new EXIFItem(id, EXIFType.Rational, data);
1268
+ }
1269
+
1270
+ addSRational(id, data)
1271
+ {
1272
+ this.exifMap[id] = new EXIFItem(id, EXIFType.SRational, data);
1273
+ }
1274
+
1275
+ addOther(id, data)
1276
+ {
1277
+ this.exifMap[id] = new EXIFItem(id, EXIFType.Other, data);
1278
+ }
1279
+
1280
+ addSubEXIF(id, data)
1281
+ {
1282
+ this.exifMap[id] = new EXIFItem(id, EXIFType.SubExif, data);
1283
+ }
1284
+
1285
+ addDouble(id, data)
1286
+ {
1287
+ this.exifMap[id] = new EXIFItem(id, EXIFType.Double, data);
1288
+ }
1289
+
1290
+ addUInt64(id, data)
1291
+ {
1292
+ this.exifMap[id] = new EXIFItem(id, EXIFType.UINT64, data);
1293
+ }
1294
+
1295
+ addInt64(id, data)
1296
+ {
1297
+ this.exifMap[id] = new EXIFItem(id, EXIFType.INT64, data);
1298
+ }
1299
+
1300
+ remove(id)
1301
+ {
1302
+ delete this.exifMap[id];
1303
+ }
1304
+
1305
+ getExifIds()
1306
+ {
1307
+ let ret = [];
1308
+ let i;
1309
+ for (i in this.exifMap)
1310
+ ret.push(i);
1311
+ return ret;
1312
+ }
1313
+
1314
+ getExifType(id)
1315
+ {
1316
+ let item = this.exifMap[id];
1317
+ if (item)
1318
+ return item.type;
1319
+ return EXIFType.Unknown;
1320
+ }
1321
+
1322
+ getExifItem(id)
1323
+ {
1324
+ return this.exifMap[id];
1325
+ }
1326
+
1327
+ getExifUInt16(id)
1328
+ {
1329
+ let item = this.exifMap[id];
1330
+ if (item && item.type == EXIFType.UINT16)
1331
+ return item.data;
1332
+ return null;
1333
+ }
1334
+
1335
+ getExifUInt32(id)
1336
+ {
1337
+ let item = this.exifMap[id];
1338
+ if (item && item.type == EXIFType.UINT32)
1339
+ return item.data;
1340
+ return null;
1341
+ }
1342
+
1343
+ getExifSubexif(id)
1344
+ {
1345
+ let item = this.exifMap[id];
1346
+ if (item && item.type == EXIFType.SubExif)
1347
+ return item.data;
1348
+ return null;
1349
+ }
1350
+
1351
+ getExifOther(id)
1352
+ {
1353
+ let item = this.exifMap[id];
1354
+ if (item && item.type == EXIFType.Other)
1355
+ return item.data;
1356
+ return null;
1357
+ }
1358
+
1359
+ getPhotoDate()
1360
+ {
1361
+ let item;
1362
+ if (this.exifMaker == EM_STANDARD)
1363
+ {
1364
+ if ((item = this.exifMap[36867]))
1365
+ {
1366
+ if (item.type == EXIFType.STRING)
1367
+ {
1368
+ return data.Timestamp.fromStr(item.data, data.DateTimeUtil.getLocalTzQhr());
1369
+ }
1370
+ }
1371
+ if ((item = this.exifMap[36868]))
1372
+ {
1373
+ if (item.type == EXIFType.STRING)
1374
+ {
1375
+ return data.Timestamp.fromStr(item.data, data.DateTimeUtil.getLocalTzQhr());
1376
+ }
1377
+ }
1378
+ if ((item = this.exifMap[34665]))
1379
+ {
1380
+ if (item.type == EXIFType.SubExif)
1381
+ {
1382
+ let ret = item.data.getPhotoDate();
1383
+ if (ret)
1384
+ return ret;
1385
+ }
1386
+ }
1387
+ if ((item = this.exifMap[306]))
1388
+ {
1389
+ if (item.type == ET_STRING)
1390
+ {
1391
+ return data.Timestamp.fromStr(item.data, data.DateTimeUtil.getLocalTzQhr());
1392
+ }
1393
+ }
1394
+ }
1395
+ return null;
1396
+ }
1397
+
1398
+ getPhotoMake()
1399
+ {
1400
+ let item;
1401
+ if (this.exifMaker == EXIFMaker.Standard)
1402
+ {
1403
+ if ((item = this.exifMap[271]))
1404
+ {
1405
+ if (item.type == EXIFType.STRING)
1406
+ {
1407
+ return item.data;
1408
+ }
1409
+ }
1410
+ }
1411
+ return null;
1412
+ }
1413
+
1414
+ getPhotoModel()
1415
+ {
1416
+ let item;
1417
+ if (this.exifMaker == EXIFMaker.Standard)
1418
+ {
1419
+ if ((item = this.exifMap[272]))
1420
+ {
1421
+ if (item.type == EXIFType.STRING)
1422
+ {
1423
+ return item.data;
1424
+ }
1425
+ }
1426
+ }
1427
+ if (this.exifMaker == EXIFMaker.Canon)
1428
+ {
1429
+ if ((item = this.exifMap[6]))
1430
+ {
1431
+ if (item.type == EXIFType.STRING)
1432
+ {
1433
+ return item.data;
1434
+ }
1435
+ }
1436
+ }
1437
+ return null;
1438
+ }
1439
+
1440
+ getPhotoLens()
1441
+ {
1442
+ let item;
1443
+ if (this.exifMaker == EXIFMaker.Canon)
1444
+ {
1445
+ if ((item = this.exifMap[149]))
1446
+ {
1447
+ if (item.type == EXIFType.STRING)
1448
+ {
1449
+ return item.data;
1450
+ }
1451
+ }
1452
+ }
1453
+ if (this.exifMaker == EXIFMaker.Panasonic)
1454
+ {
1455
+ if ((item = this.exifMap[81]))
1456
+ {
1457
+ if (item.type == EXIFType.STRING)
1458
+ {
1459
+ return item.data;
1460
+ }
1461
+ }
1462
+ }
1463
+ return null;
1464
+ }
1465
+
1466
+ getPhotoFNumber()
1467
+ {
1468
+ let item;
1469
+ if (this.exifMaker == EXIFMaker.Standard)
1470
+ {
1471
+ if ((item = this.exifMap[33437]))
1472
+ {
1473
+ if (item.type == EXIFType.Rational && item.data.length == 2)
1474
+ {
1475
+ return item.data[0] / item.data[1];
1476
+ }
1477
+ }
1478
+ if ((item = this.exifMap[34665]))
1479
+ {
1480
+ if (item.type == EXIFType.SubExif)
1481
+ {
1482
+ return item.data.getPhotoFNumber();
1483
+ }
1484
+ }
1485
+ }
1486
+ return null;
1487
+ }
1488
+
1489
+ getPhotoExpTime()
1490
+ {
1491
+ let item;
1492
+ if (this.exifMaker == EXIFMaker.Standard)
1493
+ {
1494
+ if ((item = this.exifMap[33434]))
1495
+ {
1496
+ if (item.type == EXIFType.Rational && item.data.length == 2)
1497
+ {
1498
+ return item.data[0] / item.data[1];
1499
+ }
1500
+ }
1501
+ if ((item = this.exifMap[34665]))
1502
+ {
1503
+ if (item.type == EXIFType.SubExif)
1504
+ {
1505
+ return item.data.getPhotoExpTime();
1506
+ }
1507
+ }
1508
+ }
1509
+ return null;
1510
+ }
1511
+
1512
+ getPhotoISO()
1513
+ {
1514
+ let item;
1515
+ if (this.exifMaker == EXIFMaker.Standard)
1516
+ {
1517
+ if ((item = this.exifMap[34855]))
1518
+ {
1519
+ if (item.type == EXIFType.UINT16 && item.data.length == 1)
1520
+ {
1521
+ return item.data[0];
1522
+ }
1523
+ else if (item.type == EXIFType.UINT32 && item.data.length == 1)
1524
+ {
1525
+ return item.data[0];
1526
+ }
1527
+ }
1528
+ if ((item = this.exifMap[34665]))
1529
+ {
1530
+ if (item.type == EXIFType.SubExif)
1531
+ {
1532
+ return item.data.getPhotoISO();
1533
+ }
1534
+ }
1535
+ }
1536
+ return null;
1537
+ }
1538
+
1539
+ getPhotoFocalLength()
1540
+ {
1541
+ let item;
1542
+ if (this.exifMaker == EXIFMaker.Standard)
1543
+ {
1544
+ if ((item = this.exifMap[37386]))
1545
+ {
1546
+ if (item.type == EXIFType.Rational && item.data.length == 2)
1547
+ {
1548
+ return item.data[0] / item.data[1];
1549
+ }
1550
+ }
1551
+ if ((item = this.exifMap[34665]))
1552
+ {
1553
+ if (item.type == EXIFType.SubExif)
1554
+ {
1555
+ return item.data.getPhotoFocalLength();
1556
+ }
1557
+ }
1558
+ }
1559
+ return null;
1560
+ }
1561
+
1562
+ getPhotoLocation()
1563
+ {
1564
+ let subExif = this.getExifSubexif(34853);
1565
+ if (subExif == null)
1566
+ return null;
1567
+
1568
+ let ret = {};
1569
+ let item1;
1570
+ let item2;
1571
+ let val;
1572
+ item1 = subExif.getExifItem(1);
1573
+ item2 = subExif.getExifItem(2);
1574
+ if (item1 && item2)
1575
+ {
1576
+ if (item2.type == EXIFType.Rational)
1577
+ {
1578
+ if (item2.data.length == 6)
1579
+ {
1580
+ val = item2.data[0] / item2.data[1];
1581
+ val += item2.data[2] / item2.data[3] / 60.0;
1582
+ val += item2.data[4] / item2.data[5] / 3600.0;
1583
+ }
1584
+ else if (item2.data.length == 2)
1585
+ {
1586
+ val = item2.data[0] / item2.data[1];
1587
+ }
1588
+ else
1589
+ {
1590
+ return null;
1591
+ }
1592
+ }
1593
+ else
1594
+ {
1595
+ return null;
1596
+ }
1597
+ if (item1.type == EXIFType.STRING)
1598
+ {
1599
+ if (item1.data == "S")
1600
+ {
1601
+ val = -val;
1602
+ }
1603
+ }
1604
+ else
1605
+ {
1606
+ return null;
1607
+ }
1608
+ ret.lat = va;
1609
+ }
1610
+ else
1611
+ {
1612
+ return null;
1613
+ }
1614
+ item1 = subExif.getExifItem(3);
1615
+ item2 = subExif.getExifItem(4);
1616
+ if (item1 && item2)
1617
+ {
1618
+ if (item2.type == EXIFType.Rational)
1619
+ {
1620
+ if (item2.data.length == 6)
1621
+ {
1622
+ val = item2.data[0] / item2.data[1];
1623
+ val += item2.data[2] / item2.data[3] / 60.0;
1624
+ val += item2.data[4] / item2.data[5] / 3600.0;
1625
+ }
1626
+ else if (item2.data.length == 2)
1627
+ {
1628
+ val = item2.data[0] / item2.data[1];
1629
+ }
1630
+ else
1631
+ {
1632
+ return null;
1633
+ }
1634
+ }
1635
+ else
1636
+ {
1637
+ return null;
1638
+ }
1639
+ if (item1.type == EXIFType.STRING)
1640
+ {
1641
+ if (item1.data == "W")
1642
+ {
1643
+ val = -val;
1644
+ }
1645
+ }
1646
+ else
1647
+ {
1648
+ return null;
1649
+ }
1650
+ ret.lon = val;
1651
+ }
1652
+ else
1653
+ {
1654
+ return null;
1655
+ }
1656
+ item1 = subExif.getExifItem(5);
1657
+ item2 = subExif.getExifItem(6);
1658
+ if (item1 && item2)
1659
+ {
1660
+ if (item2.type == EXIFType.Rational)
1661
+ {
1662
+ if (item2.data.length == 2)
1663
+ {
1664
+ val = item2.data[0] / item2.data[1];
1665
+ }
1666
+ else
1667
+ {
1668
+ return null;
1669
+ }
1670
+ }
1671
+ else
1672
+ {
1673
+ return null;
1674
+ }
1675
+ if (item1.type == EXIFType.Bytes && item1.data.length == 1)
1676
+ {
1677
+ if (item1.data[0] == 1)
1678
+ {
1679
+ val = -val;
1680
+ }
1681
+ }
1682
+ else if (item1.type == EXIFType.UINT16 && item1.data.length == 1)
1683
+ {
1684
+ if (item1.data[0] == 1)
1685
+ {
1686
+ val = -val;
1687
+ }
1688
+ }
1689
+ else
1690
+ {
1691
+ return false;
1692
+ }
1693
+ ret.altitude = val;
1694
+ }
1695
+ else
1696
+ {
1697
+ ret.altitude = 0;
1698
+ }
1699
+ item1 = subExif.getExifItem(7);
1700
+ item2 = subExif.getExifItem(29);
1701
+ if (item1 && item2)
1702
+ {
1703
+ let hh = 0;
1704
+ let mm = 0;
1705
+ let ss = 0;
1706
+ let ms = 0;
1707
+
1708
+ if (item1.type == EXIFType.Rational && item1.data.length == 6)
1709
+ {
1710
+ if (item1.data[1] != 1 || item1.data[3] != 1)
1711
+ {
1712
+ return null;
1713
+ }
1714
+ else
1715
+ {
1716
+ hh = item1.data[0];
1717
+ mm = item1.data[2];
1718
+ val = item1.data[4] / item.data[5];
1719
+ ss = Math.floor(val);
1720
+ ms = (val - ss);
1721
+ }
1722
+ }
1723
+ else
1724
+ {
1725
+ return null;
1726
+ }
1727
+ if (item2.type == EXIFType.STRING && item2.data.length == 11)
1728
+ {
1729
+ let dateArr = item2.data.split(":");
1730
+ if (dateArr.length != 3)
1731
+ {
1732
+ return null;
1733
+ }
1734
+ else
1735
+ {
1736
+ let tv = new data.TimeValue();
1737
+ tv.year = Number.parseInt(dateArr[0]);
1738
+ tv.month = Number.parseInt(dateArr[1]);
1739
+ tv.day = Number.parseInt(dateArr[2]);
1740
+ tv.hour = hh;
1741
+ tv.minute = mm;
1742
+ tv.second = ss;
1743
+ tv.nanosec = Math.floor(ms * 1000000000);
1744
+ tv.tzQhr = data.DateTimeUtil.getLocalTzQhr();
1745
+ ret.gpsTime = data.Timestamp.fromTimeValue(tv);
1746
+ }
1747
+ }
1748
+ else
1749
+ {
1750
+ return null;
1751
+ }
1752
+ }
1753
+ return ret;
1754
+ }
1755
+
1756
+ getProperties(id)
1757
+ {
1758
+ if (id == null)
1759
+ id = 0;
1760
+ let ret = {};
1761
+ let i;
1762
+ let item;
1763
+ let name;
1764
+ for (i in this.exifMap)
1765
+ {
1766
+ item = this.exifMap[i];
1767
+ name = EXIFData.getEXIFName(this.exifMaker, id, i);
1768
+ if (item.type == EXIFType.SubExif)
1769
+ {
1770
+ ret[name] = item.data.getProperties(i);
1771
+ }
1772
+ else if (item.id == 37500)
1773
+ {
1774
+ let innerExif = this.parseMakerNote(item.data);
1775
+ if (innerExif)
1776
+ {
1777
+ ret[name] = innerExif.getProperties(0);
1778
+ }
1779
+ else
1780
+ {
1781
+ ret[name] = item.toDataString();
1782
+ }
1783
+ }
1784
+ else
1785
+ {
1786
+ ret[name] = item.toDataString();
1787
+ }
1788
+ }
1789
+ return ret;
1790
+ }
1791
+
1792
+ parseMakerNote(buff)
1793
+ {
1794
+ let reader = new data.ByteReader(buff);
1795
+ let type = reader.readUTF8Z(0, 10);
1796
+ if (type == "Panasonic")
1797
+ {
1798
+ return EXIFData.parseIFD(reader, 12, true, null, null, EXIFMaker.Panasonic);
1799
+ }
1800
+ else if (type == "OLYMPUS")
1801
+ {
1802
+ if (reader.readUTF8(8, 2) == "II")
1803
+ {
1804
+ return EXIFData.parseIFD(reader, 12, true, null, 8, EXIFMaker.Olympus);
1805
+ }
1806
+ }
1807
+ else if (type == "OLYMP")
1808
+ {
1809
+ return EXIFData.parseIFD(reader, 8, true, null, 8, EXIFMaker.Olympus);
1810
+ }
1811
+ else if (type == "Nikon")
1812
+ {
1813
+ if (reader.readUInt8(6) == 2)
1814
+ {
1815
+ if (reader.readUTF8(10, 2) == "II")
1816
+ {
1817
+ return EXIFData.parseIFD(reader, 18, true, null, 10, EXIFMaker.Nikon3);
1818
+ }
1819
+ }
1820
+ }
1821
+ else if (type == "QVC")
1822
+ {
1823
+ return EXIFData.parseIFD(reader, 6, false, null, 6, EXIFMaker.Casio2);
1824
+ }
1825
+ else if (type == "SANYO")
1826
+ {
1827
+ return EXIFData.parseIFD(reader, 8, true, null, 8, EXIFMaker.Sanyo);
1828
+ }
1829
+ else if (type == "Apple iOS")
1830
+ {
1831
+ if (reader.readUTF8(12, 2) == "MM")
1832
+ {
1833
+ return EXIFData.parseIFD(reader, 14, false, null, 14, EXIFMaker.Apple);
1834
+ }
1835
+ else
1836
+ {
1837
+ return null;
1838
+ }
1839
+ }
1840
+ else
1841
+ {
1842
+ let maker = this.getPhotoMake();
1843
+ if (maker)
1844
+ {
1845
+ if (maker == "Canon")
1846
+ {
1847
+ return EXIFData.parseIFD(reader, 0, true, null, 0, EXIFMaker.Canon);
1848
+ }
1849
+ else if (maker == "CASIO")
1850
+ {
1851
+ return EXIFData.parseIFD(reader, 0, false, null, 0, EXIFMaker.Casio1);
1852
+ }
1853
+ else if (maker == "FLIR Systems AB")
1854
+ {
1855
+ return EXIFData.parseIFD(reader, 0, true, null, 0, EXIFMaker.FLIR);
1856
+ }
1857
+ }
1858
+ }
1859
+ return null;
1860
+ }
1861
+
1862
+ static getEXIFName(exifMaker, id, subId)
1863
+ {
1864
+ let name = null;
1865
+ if (id == 0)
1866
+ {
1867
+ switch (exifMaker)
1868
+ {
1869
+ case EXIFMaker.Panasonic:
1870
+ name = EXIFNamesPanasonic[subId];
1871
+ break;
1872
+ case EXIFMaker.Canon:
1873
+ name = EXIFNamesCanon[subId];
1874
+ break;
1875
+ case EXIFMaker.Olympus:
1876
+ name = EXIFNamesOlympus[subId];
1877
+ break;
1878
+ case EXIFMaker.Casio1:
1879
+ name = EXIFNamesCasio1[subId];
1880
+ break;
1881
+ case EXIFMaker.Casio2:
1882
+ name = EXIFNamesCasio2[subId];
1883
+ break;
1884
+ case EXIFMaker.FLIR:
1885
+ name = EXIFNamesFLIR[subId];
1886
+ break;
1887
+ case EXIFMaker.Nikon3:
1888
+ name = EXIFNamesNikon3[subId];
1889
+ break;
1890
+ case EXIFMaker.Sanyo:
1891
+ name = EXIFNamesSanyo1[subId];
1892
+ break;
1893
+ case EXIFMaker.Apple:
1894
+ name = EXIFNamesApple[subId];
1895
+ break;
1896
+ case EXIFMaker.Standard:
1897
+ default:
1898
+ name = EXIFNamesStandard[subId];
1899
+ break;
1900
+ }
1901
+ }
1902
+ else if (id == 34665)
1903
+ {
1904
+ name = EXIFNamesInfo[subId];
1905
+ }
1906
+ else if (id == 34853)
1907
+ {
1908
+ name = EXIFNamesGPS[subId];
1909
+ }
1910
+ else if (exifMaker == EXIFMaker.Olympus)
1911
+ {
1912
+ if (id == 0x2010)
1913
+ {
1914
+ name = EXIFNamesOlympus2010[subId];
1915
+ }
1916
+ else if (id == 0x2020)
1917
+ {
1918
+ name = EXIFNamesOlympus2020[subId];
1919
+ }
1920
+ else if (id == 0x2030)
1921
+ {
1922
+ name = EXIFNamesOlympus2030[subId];
1923
+ }
1924
+ else if (id == 0x2040)
1925
+ {
1926
+ name = EXIFNamesOlympus2040[subId];
1927
+ }
1928
+ else if (id == 0x2050)
1929
+ {
1930
+ name = EXIFNamesOlympus2050[subId];
1931
+ }
1932
+ }
1933
+ return name || ("Tag "+subId);
1934
+ }
1935
+
1936
+ static parseIFD(reader, ofst, lsb, nextOfst, readBase, maker)
1937
+ {
1938
+ if (!(reader instanceof data.ByteReader))
1939
+ return null;
1940
+
1941
+ if (maker == null)
1942
+ maker = EXIFMaker.Standard;
1943
+ let exif;
1944
+ let ifdCnt = reader.readUInt16(ofst, lsb);
1945
+ let readSize = ifdCnt * 12 + 4;
1946
+ if (ofst + 2 + readSize > reader.getLength())
1947
+ return null;
1948
+ exif = new EXIFData(maker);
1949
+ let i = 0;
1950
+ let ifdOfst = ofst + 2;
1951
+ let tag;
1952
+ let ftype;
1953
+ let fcnt;
1954
+
1955
+ if (readBase == null)
1956
+ {
1957
+ readBase = 0x7fffffff;
1958
+ ifdOfst = ofst + 2;
1959
+ i = 0;
1960
+ while (i < ifdCnt)
1961
+ {
1962
+ tag = reader.readUInt16(ifdOfst, lsb);
1963
+ ftype = reader.readUInt16(ifdOfst + 2, lsb);
1964
+ fcnt = reader.readUInt32(ifdOfst + 4, lsb);
1965
+
1966
+ if (ftype == 1)
1967
+ {
1968
+ if (fcnt <= 4)
1969
+ {
1970
+ }
1971
+ else
1972
+ {
1973
+ if (readBase > reader.readUInt32(ifdOfst + 8, lsb))
1974
+ {
1975
+ readBase = reader.readUInt32(ifdOfst + 8, lsb);
1976
+ }
1977
+ }
1978
+ }
1979
+ else if (ftype == 2)
1980
+ {
1981
+ if (fcnt <= 4)
1982
+ {
1983
+ }
1984
+ else
1985
+ {
1986
+ if (readBase > reader.readUInt32(ifdOfst + 8, lsb))
1987
+ {
1988
+ readBase = reader.readUInt32(ifdOfst + 8, lsb);
1989
+ }
1990
+ }
1991
+ }
1992
+ else if (ftype == 3)
1993
+ {
1994
+ if (fcnt == 1)
1995
+ {
1996
+ }
1997
+ else if (fcnt == 2)
1998
+ {
1999
+ }
2000
+ else
2001
+ {
2002
+ if (readBase > reader.readUInt32(ifdOfst + 8, lsb))
2003
+ {
2004
+ readBase = reader.readUInt32(ifdOfst + 8, lsb);
2005
+ }
2006
+ }
2007
+ }
2008
+ else if (ftype == 4)
2009
+ {
2010
+ if (fcnt == 1)
2011
+ {
2012
+ }
2013
+ else
2014
+ {
2015
+ if (readBase > reader.readUInt32(ifdOfst + 8, lsb))
2016
+ {
2017
+ readBase = reader.readUInt32(ifdOfst + 8, lsb);
2018
+ }
2019
+ }
2020
+ }
2021
+ else if (ftype == 5)
2022
+ {
2023
+ if (readBase > reader.readUInt32(ifdOfst + 8, lsb))
2024
+ {
2025
+ readBase = reader.readUInt32(ifdOfst + 8, lsb);
2026
+ }
2027
+ }
2028
+ else if (ftype == 7)
2029
+ {
2030
+ if (fcnt <= 4)
2031
+ {
2032
+ }
2033
+ else
2034
+ {
2035
+ if (readBase > reader.readUInt32(ifdOfst + 8, lsb))
2036
+ {
2037
+ readBase = reader.readUInt32(ifdOfst + 8, lsb);
2038
+ }
2039
+ }
2040
+ }
2041
+ else if (ftype == 8)
2042
+ {
2043
+ if (fcnt == 1)
2044
+ {
2045
+ }
2046
+ else if (fcnt == 2)
2047
+ {
2048
+ }
2049
+ else
2050
+ {
2051
+ if (readBase > reader.readUInt32(ifdOfst + 8, lsb))
2052
+ {
2053
+ readBase = reader.readUInt32(ifdOfst + 8, lsb);
2054
+ }
2055
+ }
2056
+ }
2057
+ else if (ftype == 12)
2058
+ {
2059
+ if (readBase > reader.readUInt32(ifdOfst + 8, lsb))
2060
+ {
2061
+ readBase = reader.readUInt32(ifdOfst + 8, lsb);
2062
+ }
2063
+ }
2064
+ else if (ftype == 13)
2065
+ {
2066
+ if (readBase > reader.readUInt32(ifdOfst + 8, lsb))
2067
+ {
2068
+ readBase = reader.readUInt32(ifdOfst + 8, lsb);
2069
+ }
2070
+ }
2071
+ else
2072
+ {
2073
+ console.log("Unknown type "+ ftype);
2074
+ }
2075
+
2076
+ ifdOfst += 12;
2077
+ i++;
2078
+ }
2079
+ readBase = ofst + ifdCnt * 12 + 2 + 4 - readBase;
2080
+ }
2081
+
2082
+ ifdOfst = ofst + 2;
2083
+ i = 0;
2084
+ while (i < ifdCnt)
2085
+ {
2086
+ tag = reader.readUInt16(ifdOfst, lsb);
2087
+ ftype = reader.readUInt16(ifdOfst + 2, lsb);
2088
+ fcnt = reader.readUInt32(ifdOfst + 4, lsb);
2089
+
2090
+ switch (ftype)
2091
+ {
2092
+ case 1:
2093
+ if (fcnt <= 4)
2094
+ {
2095
+ exif.addBytes(tag, reader.readUInt8Arr(ifdOfst + 8, fcnt));
2096
+ }
2097
+ else
2098
+ {
2099
+ exif.addBytes(tag, reader.readUInt8Arr(reader.readUInt32(ifdOfst + 8, lsb) + readBase, fcnt));
2100
+ }
2101
+ break;
2102
+ case 2:
2103
+ if (fcnt <= 4)
2104
+ {
2105
+ exif.addString(tag, reader.readUTF8Z(ifdOfst + 8, fcnt));
2106
+ }
2107
+ else
2108
+ {
2109
+ exif.addString(tag, reader.readUTF8Z(reader.readUInt32(ifdOfst + 8, lsb) + readBase, fcnt));
2110
+ }
2111
+ break;
2112
+ case 3:
2113
+ {
2114
+ if (fcnt <= 2)
2115
+ {
2116
+ exif.addUInt16(tag, reader.readUInt16Arr(ifdOfst + 8, lsb, fcnt));
2117
+ }
2118
+ else
2119
+ {
2120
+ exif.addUInt16(tag, reader.readUInt16Arr(reader.readUInt32(ifdOfst + 8, lsb) + readBase, lsb, fcnt));
2121
+ }
2122
+ break;
2123
+ }
2124
+ case 4:
2125
+ {
2126
+ if (fcnt == 1)
2127
+ {
2128
+ let tmp = reader.readUInt32(ifdOfst + 8, lsb);
2129
+ if (tag == 34665 || tag == 34853)
2130
+ {
2131
+ let subexif = EXIFData.parseIFD(reader, tmp + readBase, lsb, null, readBase);
2132
+ if (subexif)
2133
+ {
2134
+ exif.addSubEXIF(tag, subexif);
2135
+ }
2136
+ else
2137
+ {
2138
+ console.log("Error in parsing subExif of tag "+tag);
2139
+ }
2140
+ }
2141
+ else
2142
+ {
2143
+ exif.addUInt32(tag, [tmp]);
2144
+ }
2145
+ }
2146
+ else
2147
+ {
2148
+ exif.addUInt32(tag, reader.readUInt32Arr(reader.readUInt32(ifdOfst + 8, lsb) + readBase, lsb, fcnt));
2149
+ }
2150
+ break;
2151
+ }
2152
+ case 5:
2153
+ exif.addRational(tag, reader.readUInt32Arr(reader.readUInt32(ifdOfst + 8, lsb) + readBase, lsb, fcnt << 1));
2154
+ break;
2155
+ case 7:
2156
+ if (fcnt <= 4)
2157
+ {
2158
+ exif.addOther(tag, reader.getArrayBuffer(ifdOfst + 8, fcnt));
2159
+ }
2160
+ else
2161
+ {
2162
+ exif.addOther(tag, reader.getArrayBuffer(reader.readUInt32(ifdOfst + 8, lsb) + readBase, fcnt));
2163
+ }
2164
+ break;
2165
+ case 8:
2166
+ if (fcnt <= 2)
2167
+ {
2168
+ exif.addInt16(tag, reader.readInt16Arr(ifdOfst + 8, fcnt));
2169
+ }
2170
+ else
2171
+ {
2172
+ exif.addInt16(tag, reader.readInt16Arr(reader.readUInt32(ifdOfst + 8, lsb) + readBase, lsb, fcnt));
2173
+ }
2174
+ break;
2175
+ case 9:
2176
+ if (fcnt == 1)
2177
+ {
2178
+ exif.addInt32(tag, reader.readInt32Arr(ifdOfst + 8, fcnt));
2179
+ }
2180
+ else
2181
+ {
2182
+ exif.addInt32(tag, reader.readInt32Arr(reader.readInt32(ifdOfst + 8, lsb) + readBase, lsb, fcnt));
2183
+ }
2184
+ break;
2185
+ case 10:
2186
+ exif.addSRational(tag, reader.readInt32Arr(reader.readUInt32(ifdOfst + 8, lsb) + readBase, lsb, fcnt << 1));
2187
+ break;
2188
+ case 12:
2189
+ exif.addDouble(tag, reader.readFloat64Arr(reader.readUInt32(ifdOfst + 8, lsb) + readBase, lsb, fcnt));
2190
+ break;
2191
+ default:
2192
+ console.log("EXIFData.parseIFD: Unsupported field type: "+ftype+", tag = "+tag);
2193
+ j = 0;
2194
+ break;
2195
+ }
2196
+
2197
+ ifdOfst += 12;
2198
+ i++;
2199
+ }
2200
+
2201
+ if (nextOfst)
2202
+ {
2203
+ nextOfst.nextOfst = reader.readUInt32(ifdOfst + ifdCnt * 12, lsb);
2204
+ }
2205
+ return exif;
2206
+ }
2207
+ }
2208
+
2209
+ export class StaticImage
2210
+ {
2211
+ constructor(img)
2212
+ {
2213
+ this.img = img;
2214
+ }
2215
+
2216
+ setExif(exif)
2217
+ {
2218
+ this.exif = exif;
2219
+ }
2220
+
2221
+ getWidth()
2222
+ {
2223
+ return this.img.naturalWidth || this.img.width;
2224
+ }
2225
+
2226
+ getHeight()
2227
+ {
2228
+ return this.img.naturalHeight || this.img.height;
2229
+ }
2230
+
2231
+ getProperties()
2232
+ {
2233
+ let ret = {width: this.getWidth(), height: this.getHeight()};
2234
+ if (this.exif)
2235
+ ret.exif = this.exif.getProperties();
2236
+ return ret;
2237
+ }
2238
+
2239
+ createCanvas()
2240
+ {
2241
+ let canvas = document.createElement("canvas");
2242
+ canvas.width = this.img.naturalWidth;
2243
+ canvas.height = this.img.naturalHeight;
2244
+ let ctx = canvas.getContext("2d");
2245
+ ctx.drawImage(this.img, 0, 0, this.img.naturalWidth, this.img.naturalHeight);
2246
+ return canvas;
2247
+ }
2248
+
2249
+ exportJPG(quality)
2250
+ {
2251
+ let canvas = this.createCanvas();
2252
+ return new Promise(function (resolve, reject) {
2253
+ canvas.toBlob((blob)=>{resolve(blob);}, "image/jpeg", quality);
2254
+ });
2255
+ }
2256
+ exportWEBP(quality)
2257
+ {
2258
+ let canvas = this.createCanvas();
2259
+ return new Promise(function (resolve, reject) {
2260
+ canvas.toBlob((blob)=>{resolve(blob);}, "image/webp", quality);
2261
+ });
2262
+ }
2263
+
2264
+ exportPNG()
2265
+ {
2266
+ let canvas = this.createCanvas();
2267
+ return new Promise(function (resolve, reject) {
2268
+ canvas.toBlob((blob)=>{resolve(blob);}, "image/png");
2269
+ });
2270
+ }
2271
+ }