forked from mozilla-b2g/exif-parser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jpeg.js
3203 lines (3066 loc) · 128 KB
/
jpeg.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/**
* jpegjs.js v0.0.1 by @dmarcos
* Copyright 2013 Diego Marcos <[email protected]>
*
*/
'use strict';
var JPEG = JPEG || {};
JPEG.BlobView = (function() {
function fail(msg) {
throw Error(msg);
}
// This constructor is for internal use only.
// Use the BlobView.get() factory function or the getMore instance method
// to obtain a BlobView object.
function BlobView(blob, sliceOffset, sliceLength, slice,
viewOffset, viewLength, littleEndian)
{
this.blob = blob; // The parent blob that the data is from
this.sliceOffset = sliceOffset; // The start address within the blob
this.sliceLength = sliceLength; // How long the slice is
this.slice = slice; // The ArrayBuffer of slice data
this.viewOffset = viewOffset; // The start of the view within the slice
this.viewLength = viewLength; // The length of the view
this.littleEndian = littleEndian; // Read little endian by default?
// DataView wrapper around the ArrayBuffer
this.view = new DataView(slice, viewOffset, viewLength);
// These fields mirror those of DataView
this.buffer = slice;
this.byteLength = viewLength;
this.byteOffset = viewOffset;
this.index = 0; // The read methods keep track of the read position
}
// Async factory function
BlobView.get = function(blob, offset, length, callback, littleEndian) {
if (offset < 0)
fail('negative offset');
if (length < 0)
fail('negative length');
if (offset > blob.size)
fail('offset larger than blob size');
// Don't fail if the length is too big; just reduce the length
if (offset + length > blob.size)
length = blob.size - offset;
var slice = blob.slice(offset, offset + length);
var reader = new FileReader();
reader.readAsArrayBuffer(slice);
reader.onloadend = function() {
var result = null;
if (reader.result) {
result = new BlobView(blob, offset, length, reader.result,
0, length, littleEndian || false);
}
callback(result, reader.error);
};
};
BlobView.prototype = {
constructor: BlobView,
// This instance method is like the BlobView.get() factory method,
// but it is here because if the current buffer includes the requested
// range of bytes, they can be passed directly to the callback without
// going back to the blob to read them
getMore: function(offset, length, callback) {
if (offset >= this.sliceOffset &&
offset + length <= this.sliceOffset + this.sliceLength) {
// The quick case: we already have that region of the blob
callback(new BlobView(this.blob,
this.sliceOffset, this.sliceLength, this.slice,
offset - this.sliceOffset, length,
this.littleEndian));
}
else {
// Otherwise, we have to do an async read to get more bytes
BlobView.get(this.blob, offset, length, callback, this.littleEndian);
}
},
// Set the default endianness for the other methods
littleEndian: function() {
this.littleEndian = true;
},
bigEndian: function() {
this.littleEndian = false;
},
// These "get" methods are just copies of the DataView methods, except
// that they honor the default endianness
getUint8: function(offset) {
return this.view.getUint8(offset);
},
getInt8: function(offset) {
return this.view.getInt8(offset);
},
getUint16: function(offset, le) {
return this.view.getUint16(offset,
le !== undefined ? le : this.littleEndian);
},
getInt16: function(offset, le) {
return this.view.getInt16(offset,
le !== undefined ? le : this.littleEndian);
},
getUint32: function(offset, le) {
return this.view.getUint32(offset,
le !== undefined ? le : this.littleEndian);
},
getInt32: function(offset, le) {
return this.view.getInt32(offset,
le !== undefined ? le : this.littleEndian);
},
getFloat32: function(offset, le) {
return this.view.getFloat32(offset,
le !== undefined ? le : this.littleEndian);
},
getFloat64: function(offset, le) {
return this.view.getFloat64(offset,
le !== undefined ? le : this.littleEndian);
},
// These "set" methods are just copies of the DataView methods, except
// that they honor the default endianness
setUint8: function(offset, value) {
return this.view.setUint8(offset, value);
},
setInt8: function(offset, value) {
return this.view.setInt8(offset, value);
},
setUint16: function(offset, value, le) {
return this.view.setUint16(offset, value,
le !== undefined ? le : this.littleEndian);
},
setInt16: function(offset, value, le) {
return this.view.setInt16(offset, value,
le !== undefined ? le : this.littleEndian);
},
setUint32: function(offset, value, le) {
return this.view.setUint32(offset, value,
le !== undefined ? le : this.littleEndian);
},
setInt32: function(offset, value, le) {
return this.view.setInt32(offset, value,
le !== undefined ? le : this.littleEndian);
},
setFloat32: function(offset, value, le) {
return this.view.setFloat32(offset, value,
le !== undefined ? le : this.littleEndian);
},
setFloat64: function(offset, value, le) {
return this.view.setFloat64(offset, value,
le !== undefined ? le : this.littleEndian);
},
// These "read" methods read from the current position in the view and
// update that position accordingly
readByte: function() {
return this.view.getInt8(this.index++);
},
readUnsignedByte: function() {
return this.view.getUint8(this.index++);
},
readShort: function(le) {
var val = this.view.getInt16(this.index,
le !== undefined ? le : this.littleEndian);
this.index += 2;
return val;
},
readUnsignedShort: function(le) {
var val = this.view.getUint16(this.index,
le !== undefined ? le : this.littleEndian);
this.index += 2;
return val;
},
readInt: function(le) {
var val = this.view.getInt32(this.index,
le !== undefined ? le : this.littleEndian);
this.index += 4;
return val;
},
readUnsignedInt: function(le) {
var val = this.view.getUint32(this.index,
le !== undefined ? le : this.littleEndian);
this.index += 4;
return val;
},
readFloat: function(le) {
var val = this.view.getFloat32(this.index,
le !== undefined ? le : this.littleEndian);
this.index += 4;
return val;
},
readDouble: function(le) {
var val = this.view.getFloat64(this.index,
le !== undefined ? le : this.littleEndian);
this.index += 8;
return val;
},
// Methods to get and set the current position
tell: function() {
return this.index;
},
seek: function(index) {
if (index < 0)
fail('negative index');
if (index >= this.byteLength)
fail('index greater than buffer size');
this.index = index;
},
advance: function(n) {
var index = this.index + n;
if (index < 0)
fail('advance past beginning of buffer');
// It's usual that when we finished reading one target view,
// the index is advanced to the start(previous end + 1) of next view,
// and the new index will be equal to byte length(the last index + 1),
// we will not fail on it because it means the reading is finished,
// or do we have to warn here?
if (index > this.byteLength)
fail('advance past end of buffer');
this.index = index;
},
// Additional methods to read other useful things
getUnsignedByteArray: function(offset, n) {
return new Uint8Array(this.buffer, offset + this.viewOffset, n);
},
// Additional methods to read other useful things
readUnsignedByteArray: function(n) {
var val = new Uint8Array(this.buffer, this.index + this.viewOffset, n);
this.index += n;
return val;
},
getBit: function(offset, bit) {
var byte = this.view.getUint8(offset);
return (byte & (1 << bit)) !== 0;
},
getUint24: function(offset, le) {
var b1, b2, b3;
if (le !== undefined ? le : this.littleEndian) {
b1 = this.view.getUint8(offset);
b2 = this.view.getUint8(offset + 1);
b3 = this.view.getUint8(offset + 2);
}
else { // big end first
b3 = this.view.getUint8(offset);
b2 = this.view.getUint8(offset + 1);
b1 = this.view.getUint8(offset + 2);
}
return (b3 << 16) + (b2 << 8) + b1;
},
readUint24: function(le) {
var value = this.getUint24(this.index, le);
this.index += 3;
return value;
},
// There are lots of ways to read strings.
// ASCII, UTF-8, UTF-16.
// null-terminated, character length, byte length
// I'll implement string reading methods as needed
getASCIIText: function(offset, len) {
var bytes = new Uint8Array(this.buffer, offset + this.viewOffset, len);
return String.fromCharCode.apply(String, bytes);
},
getNullTerminatedASCIIString: function(offset) {
var string = "";
var characterCode;
while (offset < this.sliceLength) {
characterCode = this.view.getUint8(offset);
if (characterCode === 0) {
break;
}
string += String.fromCharCode(characterCode);
offset++;
}
return string;
},
readASCIIText: function(len) {
var bytes = new Uint8Array(this.buffer,
this.index + this.viewOffset,
len);
this.index += len;
return String.fromCharCode.apply(String, bytes);
},
// Replace this with the StringEncoding API when we've got it.
// See https://bugzilla.mozilla.org/show_bug.cgi?id=764234
getUTF8Text: function(offset, len) {
function fail() { throw new Error('Illegal UTF-8'); }
var pos = offset; // Current position in this.view
var end = offset + len; // Last position
var charcode; // Current charcode
var s = ''; // Accumulate the string
var b1, b2, b3, b4; // Up to 4 bytes per charcode
// See http://en.wikipedia.org/wiki/UTF-8
while (pos < end) {
var b1 = this.view.getUint8(pos);
if (b1 < 128) {
s += String.fromCharCode(b1);
pos += 1;
}
else if (b1 < 194) {
// unexpected continuation character...
fail();
}
else if (b1 < 224) {
// 2-byte sequence
if (pos + 1 >= end)
fail();
b2 = this.view.getUint8(pos + 1);
if (b2 < 128 || b2 > 191)
fail();
charcode = ((b1 & 0x1f) << 6) + (b2 & 0x3f);
s += String.fromCharCode(charcode);
pos += 2;
}
else if (b1 < 240) {
// 3-byte sequence
if (pos + 3 >= end)
fail();
b2 = this.view.getUint8(pos + 1);
if (b2 < 128 || b2 > 191)
fail();
b3 = this.view.getUint8(pos + 2);
if (b3 < 128 || b3 > 191)
fail();
charcode = ((b1 & 0x0f) << 12) + ((b2 & 0x3f) << 6) + (b3 & 0x3f);
s += String.fromCharCode(charcode);
pos += 3;
}
else if (b1 < 245) {
// 4-byte sequence
if (pos + 3 >= end)
fail();
b2 = this.view.getUint8(pos + 1);
if (b2 < 128 || b2 > 191)
fail();
b3 = this.view.getUint8(pos + 2);
if (b3 < 128 || b3 > 191)
fail();
b4 = this.view.getUint8(pos + 3);
if (b4 < 128 || b4 > 191)
fail();
charcode = ((b1 & 0x07) << 18) +
((b2 & 0x3f) << 12) +
((b3 & 0x3f) << 6) +
(b4 & 0x3f);
// Now turn this code point into two surrogate pairs
charcode -= 0x10000;
s += String.fromCharCode(0xd800 + ((charcode & 0x0FFC00) >>> 10));
s += String.fromCharCode(0xdc00 + (charcode & 0x0003FF));
pos += 4;
}
else {
// Illegal byte
fail();
}
}
return s;
},
readUTF8Text: function(len) {
try {
return this.getUTF8Text(this.index, len);
}
finally {
this.index += len;
}
},
// Read 4 bytes, ignore the high bit and combine them into a 28-bit
// big-endian unsigned integer.
// This format is used by the ID3v2 metadata.
getID3Uint28BE: function(offset) {
var b1 = this.view.getUint8(offset) & 0x7f;
var b2 = this.view.getUint8(offset + 1) & 0x7f;
var b3 = this.view.getUint8(offset + 2) & 0x7f;
var b4 = this.view.getUint8(offset + 3) & 0x7f;
return (b1 << 21) | (b2 << 14) | (b3 << 7) | b4;
},
readID3Uint28BE: function() {
var value = this.getID3Uint28BE(this.index);
this.index += 4;
return value;
},
// Read bytes up to and including a null terminator, but never
// more than size bytes. And return as a Latin1 string
readNullTerminatedLatin1Text: function(size) {
var s = '';
for (var i = 0; i < size; i++) {
var charcode = this.view.getUint8(this.index + i);
if (charcode === 0) {
i++;
break;
}
s += String.fromCharCode(charcode);
}
this.index += i;
return s;
},
// Read bytes up to and including a null terminator, but never
// more than size bytes. And return as a UTF8 string
readNullTerminatedUTF8Text: function(size) {
for (var len = 0; len < size; len++) {
if (this.view.getUint8(this.index + len) === 0)
break;
}
var s = this.readUTF8Text(len);
if (len < size) // skip the null terminator if we found one
this.advance(1);
return s;
},
// Read UTF16 text. If le is not specified, expect a BOM to define
// endianness. If le is true, read UTF16LE, if false, UTF16BE
// Read until we find a null-terminator, but never more than size bytes
readNullTerminatedUTF16Text: function(size, le) {
if (le == null) {
var BOM = this.readUnsignedShort();
size -= 2;
if (BOM === 0xFEFF)
le = false;
else
le = true;
}
var s = '';
for (var i = 0; i < size; i += 2) {
var charcode = this.getUint16(this.index + i, le);
if (charcode === 0) {
i += 2;
break;
}
s += String.fromCharCode(charcode);
}
this.index += i;
return s;
}
};
// We don't want users of this library to accidentally call the constructor
// instead of using the factory function, so we return a dummy object
// instead of the real constructor. If someone really needs to get at the
// real constructor, the contructor property of the prototype refers to it.
return { get: BlobView.get };
}());
(function() {
var tagTypes = {
BYTE: 1,
ASCII: 2,
SHORT: 3,
LONG: 4,
RATIONAL: 5,
SBYTE: 6,
UNDEFINED: 7,
SSHORT: 8,
SLONG: 9,
SRATIONAL: 10,
FLOAT: 11,
DOUBLE: 12
};
var tagTypesString = {
1: "BYTE",
2: "ASCII",
3: "SHORT",
4: "LONG",
5: "RATIONAL",
6: "SBYTE",
7: "UNDEFINED",
8: "SSHORT",
9: "SLONG",
10: "SRATIONAL",
11: "FLOAT",
12: "DOUBLE"
};
var tagTypeSize = {
1: 1, // BYTE
3: 2, // SHORT
4: 4, // LONG
5: 8, // RATIONAL
6: 1, // SBYTE
7: 1, // UNDEFINED
8: 2, // SSHORT
9: 4, // SLONG
10: 8, // SRATIONAL
11: 4, // FLOAT
12: 8 // DOUBLE
};
var IFDId = {
Image: 1,
Photo: 2,
GPSInfo: 3,
Iop: 4
};
var interOperabilityTags = {
"1": { // Indicates the identification of the Interoperability rule. Use "R98" for stating ExifR98 Rules. Four bytes used including the termination code (NULL). see the separate volume of Recommended Exif Interoperability Rules (ExifR98) for other tags used for ExifR98.
"IFD": 4,
"key": "InteroperabilityIndex",
"type": 2
},
"2": { // Interoperability version
"IFD": 4,
"key": "InteroperabilityVersion",
"type": 7
},
"4096": { // File format of image file
"IFD": 4,
"key": "RelatedImageFileFormat",
"type": 2
},
"4097": { // Image width
"IFD": 4,
"key": "RelatedImageWidth",
"type": 4
},
"4098": { // Image height
"IFD": 4,
"key": "RelatedImageLength",
"type": 4
}
};
// Tags supported by the 2.2 Standard
var tags = {
"0": { // Indicates the version of <GPSInfoIFD>. The version is given as 2.0.0.0. This tag is mandatory when <GPSInfo> tag is present. (Note: The <GPSVersionID> tag is given in byte s, unlike the <ersion> tag. When the version is 2.0.0.0, the tag value is 02000000.H).
"IFD": 3,
"key": "GPSVersionID",
"type": 1
},
"1": { // Indicates whether the latitude is north or south latitude. The ASCII value 'N' indicates north latitude, and 'S' is south latitude.
"IFD": 3,
"key": "GPSLatitudeRef",
"type": 2
},
"2": { // Indicates the latitude. The latitude is expressed as three,Rational values giving the degrees, minutes, and seconds, respectively. When degrees, minutes and seconds are expressed, the format is dd/1, mm/1, ss/1. When degrees and minutes are used and, for example, fractions of minutes are given up to two decimal places, the format is dd/1, mmmm/100, 0/1.
"IFD": 3,
"key": "GPSLatitude",
"type": 5
},
"3": { // Indicates whether the LONGitude is east or west LONGitude.ASCII 'E' indicates east LONGitude, and 'W' is west LONGitude.
"IFD": 3,
"key": "GPSLongitudeRef",
"type": 2
},
"4": { // Indicates the LONGitude. The LONGitude is expressed as three,Rational values giving the degrees, minutes, and seconds, respectively. When degrees, minutes and seconds are expressed, the format is ddd/1, mm/1, ss/1. When degrees and minutes are used and, for example, fractions of minutes are given up to two decimal places, the format is ddd/1, mmmm/100, 0/1.
"IFD": 3,
"key": "GPSLongitude",
"type": 5
},
"5": { // Indicates the altitude used as the reference altitude. If the reference is sea level and the altitude is above sea level, 0 is given. If the altitude is below sea level, a value of 1 is given and the altitude is indicated as an absolute value in the GSPAltitude tag. The reference unit is meters. Note that this tag is Byte type, unlike other reference tags.
"IFD": 3,
"key": "GPSAltitudeRef",
"type": 1
},
"6": { // Indicates the altitude based on the reference in GPSAltitudeRef. Altitude is expressed as one rational value. The reference unit is meters.
"IFD": 3,
"key": "GPSAltitude",
"type": 5
},
"7": { // Indicates the time as UTC (Coordinated Universal Time). <TimeStamp> is expressed as three rational values giving the hour, minute, and second (atomic clock).
"IFD": 3,
"key": "GPSTimeStamp",
"type": 5
},
"8": { // Indicates the GPS satellites used for measurements. This tag can be used to describe the number of satellites, their ID number, angle of elevation, azimuth, SNR and other information in ASCII notation. The format is not specified. If the GPS receiver is incapable of taking measurements, value of the tag is set to NULL.
"IFD": 3,
"key": "GPSSatellites",
"type": 2
},
"9": { // Indicates the status of the GPS receiver when the image is recorded. 'A' means measurement is in progress, and 'V' means the measurement is Interoperability.
"IFD": 3,
"key": "GPSStatus",
"type": 2
},
"10": { // Indicates the GPS measurement mode. '2' means two-dimensional measurement and '3' means three-dimensional measurement is in progress.
"IFD": 3,
"key": "GPSMeasureMode",
"type": 2
},
"11": { // Indicates the GPS DOP (data degree of precision). An HDOP value is written during two-dimensional measurement, and PDOP during three-dimensional measurement.
"IFD": 3,
"key": "GPSDOP",
"type": 5
},
"12": { // Indicates the unit used to express the GPS receiver speed of movement. 'K' 'M' and 'N' represents kilometers per hour, miles per hour, and knots.
"IFD": 3,
"key": "GPSSpeedRef",
"type": 2
},
"13": { // Indicates the speed of GPS receiver movement.
"IFD": 3,
"key": "GPSSpeed",
"type": 5
},
"14": { // Indicates the reference for giving the direction of GPS receiver movement. 'T' denotes true direction and 'M' is magnetic direction.
"IFD": 3,
"key": "GPSTrackRef",
"type": 2
},
"15": { // Indicates the direction of GPS receiver movement. The range of values is from 0.00 to 359.99.
"IFD": 3,
"key": "GPSTrack",
"type": 5
},
"16": { // Indicates the reference for giving the direction of the image when it is captured. 'T' denotes true direction and 'M' is magnetic direction.
"IFD": 3,
"key": "GPSImgDirectionRef",
"type": 2
},
"17": { // Indicates the direction of the image when it was captured. The range of values is from 0.00 to 359.99.
"IFD": 3,
"key": "GPSImgDirection",
"type": 5
},
"18": { // Indicates the geodetic survey data used by the GPS receiver. If the survey data is restricted to Japan, the value of this tag is 'TOKYO' or 'WGS-84'.
"IFD": 3,
"key": "GPSMapDatum",
"type": 2
},
"19": { // Indicates whether the latitude of the destination point is north or south latitude. The ASCII value 'N' indicates north latitude, and 'S' is south latitude.
"IFD": 3,
"key": "GPSDestLatitudeRef",
"type": 2
},
"20": { // Indicates the latitude of the destination point. The latitude is expressed as three rational values giving the degrees, minutes, and seconds, respectively. If latitude is expressed as degrees, minutes and seconds, a typical format would be dd/1, mm/1, ss/1. When degrees and minutes are used and, for example, fractions of minutes are given up to two decimal places, the format would be dd/1, mmmm/100, 0/1.
"IFD": 3,
"key": "GPSDestLatitude",
"type": 5
},
"21": { // Indicates whether the LONGitude of the destination point is east or west LONGitude. ASCII 'E' indicates east LONGitude, and 'W' is west LONGitude.
"IFD": 3,
"key": "GPSDestLONGitudeRef",
"type": 2
},
"22": { // Indicates the LONGitude of the destination point. The LONGitude is expressed as three,Rational values giving the degrees, minutes, and seconds, respectively. If LONGitude is expressed as degrees, minutes and seconds, a typical format would be ddd/1, mm/1, ss/1. When degrees and minutes are used and, for example, fractions of minutes are given up to two decimal places, the format would be ddd/1, mmmm/100, 0/1.
"IFD": 3,
"key": "GPSDestLONGitude",
"type": 5
},
"23": { // Indicates the reference used for giving the bearing to the destination point. 'T' denotes true direction and 'M' is magnetic direction.
"IFD": 3,
"key": "GPSDestBearingRef",
"type": 2
},
"24": { // Indicates the bearing to the destination point. The range of values is from 0.00 to 359.99.
"IFD": 3,
"key": "GPSDestBearing",
"type": 5
},
"25": { // Indicates the unit used to express the distance to the destination point. 'K' 'M' and 'N' represent kilometers, miles and knots.
"IFD": 3,
"key": "GPSDestDistanceRef",
"type": 2
},
"26": { // Indicates the distance to the destination point.
"IFD": 3,
"key": "GPSDestDistance",
"type": 5
},
"27": { // A character string recording the name of the method used for location finding. The first byte indicates the character code used, and this is followed by the name of the method.
"IFD": 3,
"key": "GPSProcessingMethod",
"type": 7
},
"28": { // A character string recording the name of the GPS area. The first byte indicates the character code used, and this is followed by the name of the GPS area.
"IFD": 3,
"key": "GPSAreaInformation",
"type": 7
},
"29": { // A character string recording date and time information relative to UTC (Coordinated Universal Time). The format is 'YYYY:MM:DD'.
"IFD": 3,
"key": "GPSDateStamp",
"type": 2
},
"30": { // Indicates whether differential correction is applied to the GPS receiver.
"IFD": 3,
"key": "GPSDifferential",
"type": 3
},
"254": { // A general indication of the kind of data contained in this subfile.
"IFD": 1,
"key": "NewSubfileType",
"type": 4
},
"255": { // A general indication of the kind of data contained in this subfile. This field is deprecated. The NewSubfileType field should be used instead.
"IFD": 1,
"key": "SubfileType",
"type": 3
},
"256": { // The number of columns of image data, equal to the number of pixels per row. In JPEG compressed data a JPEG marker is used instead of this tag.
"IFD": 1,
"key": "ImageWidth",
"type": 4
},
"257": { // The number of rows of image data. In JPEG compressed data a JPEG marker is used instead of this tag.
"": 1,
"key": "ImageLength",
"type": 4
},
"258": { // The number of bits per image component. In this standard each component of the image is 8 bits, so the value for this tag is 8. See also <SamplesPerPixel>. In JPEG compressed data a JPEG marker is used instead of this tag.
"IFD": 1,
"key": "BitsPerSample",
"type": 3
},
"259": { // The compression scheme used for the image data. When a primary image is JPEG compressed, this designation is not necessary and is omitted. When thumbnails use JPEG compression, this tag value is set to 6.
"IFD": 1,
"key": "Compression",
"type": 3
},
"262": { // The pixel composition. In JPEG compressed data a JPEG marker is used instead of this tag.
"IFD": 1,
"key": "PhotometricInterpretation",
"type": 3
},
"263": { // For black and white TIFF files that represent shades of gray, the technique used to convert from gray to black and white pixels.
"IFD": 1,
"key": "Threshholding",
"type": 3
},
"264": { // The width of the dithering or halftoning matrix used to create a dithered or halftoned bilevel file.
"IFD": 1,
"key": "CellWidth",
"type": 3
},
"265": { // The length of the dithering or halftoning matrix used to create a dithered or halftoned bilevel file.
"IFD": 1,
"key": "CellLength",
"type": 3
},
"266": { // The logical order of bits within a byte
"IFD": 1,
"key": "FillOrder",
"type": 3
},
"269": { // The name of the document from which this image was scanned
"IFD": 1,
"key": "DocumentName",
"type": 2
},
"270": { // A character string giving the title of the image. It may be a comment such as '1988 company picnic' or the like. Two-bytes character codes cannot be used. When a 2-bytes code is necessary, the Private tag <UserComment> is to be used.
"IFD": 1,
"key": "ImageDescription",
"type": 2
},
"271": { // The manufacturer of the recording equipment. This is the manufacturer of the DSC, scanner, video digitizer or other equipment that generated the image. When the field is left blank, it is treated as unknown.
"IFD": 1,
"key": "Make",
"type": 2
},
"272": { // The model name or model number of the equipment. This is the model name or number of the DSC, scanner, video digitizer or other equipment that generated the image. When the field is left blank, it is treated as unknown.
"IFD": 1,
"key": "Model",
"type": 2
},
"273": { // For each strip, the byte offset of that strip. It is recommended that this be selected so the number of strip byte s does not exceed 64 Kbytes. With JPEG compressed data this designation is not needed and is omitted. See also <RowsPerStrip> and <StripByteCounts>.
"IFD": 1,
"key": "StripOffsets",
"type": 4
},
"274": { // The image orientation viewed in terms of rows and columns.
"IFD": 1,
"key": "Orientation",
"type": 3
},
"277": { // The number of components per pixel. Since this standard applies to RGB and YCbCr images, the value set for this tag is 3. In JPEG compressed data a JPEG marker is used instead of this tag.
"IFD": 1,
"key": "SamplesPerPixel",
"type": 3
},
"278": { // The number of rows per strip. This is the number of rows in the image of one strip when an image is divided into strips. With JPEG compressed data this designation is not needed and is omitted. See also <StripOffsets> and <StripByteCounts>.
"IFD": 1,
"key": "RowsPerStrip",
"type": 4
},
"279": { // The total number of byte s in each strip. With JPEG compressed data this designation is not needed and is omitted.
"IFD": 1,
"key": "StripByteCounts",
"type": 4
},
"282": { // The number of pixels per <ResolutionUnit> in the <ImageWidth> direction. When the image resolution is unknown, 72 [dpi] is designated.
"IFD": 1,
"key": "XResolution",
"type": 5
},
"283": { // The number of pixels per <ResolutionUnit> in the <ImageLength> direction. The same value as <XResolution> is designated.
"IFD": 1,
"key": "YResolution",
"type": 5
},
"284": { // Indicates whether pixel components are recorded in a chunky or planar format. In JPEG compressed files a JPEG marker is used instead of this tag. If this field does not exist, the TIFF default of 1 (chunky) is assumed.
"IFD": 1,
"key": "PlanarConfiguration",
"type": 3
},
"290": { // The precision of the information contained in the GrayResponseCurve.
"IFD": 1,
"key": "GrayResponseUnit",
"type": 3
},
"291": { // For grayscale data, the optical density of each possible pixel value.
"IFD": 1,
"key": "GrayResponseCurve",
"type": 3
},
"292": { // T.4-encoding options.
"IFD": 1,
"key": "T4Options",
"type": 4
},
"293": { // T.6-encoding options.
"IFD": 1,
"key": "T6Options",
"type": 4
},
"296": { // The unit for measuring <XResolution> and <YResolution>. The same unit is used for both <XResolution> and <YResolution>. If the image resolution is unknown, 2 (inches) is designated.
"IFD": 1,
"key": "ResolutionUnit",
"type": 3
},
"301": { // A transfer function for the image, described in tabular style. Normally this tag is not necessary, since color space is specified in the color space information tag (<ColorSpace>).
"IFD": 1,
"key": "TransferFunction",
"type": 3
},
"305": { // This tag records the name and version of the software or firmware of the camera or image input device used to generate the image. The detailed format is not specified, but it is recommended that the example shown below be followed. When the field is left blank, it is treated as unknown.
"IFD": 1,
"key": "Software",
"type": 2
},
"306": { // The date and time of image creation. In standard, it is the date and time the file was changed.
"IFD": 1,
"key": "DateTime",
"type": 2
},
"315": { // This tag records the name of the camera owner, photographer or image creator. The detailed format is not specified, but it is recommended that the information be written as in the example below for ease of Interoperability. When the field is left blank, it is treated as unknown. Ex.) 'Camera owner, John Smith; Photographer, Michael Brown; Image creator, Ken James
"IFD": 1,
"key": "Artist",
"type": 2
},
"316": { // This tag records information about the host computer used to generate the image.
"IFD": 1,
"key": "HostComputer",
"type": 2
},
"317": { // A predictor is a mathematical operator that is applied to the image data before an encoding scheme is applied.
"IFD": 1,
"key": "Predictor",
"type": 3
},
"318": { // The chromaticity of the white point of the image. Normally this tag is not necessary, since color space is specified in the colorspace information tag (<ColorSpace>)."
"IFD": 1,
"key": "WhitePoint",
"type": 5
},
"319": { // The chromaticity of the three primary colors of the image. Normally this tag is not necessary, since colorspace is specified in the colorspace information tag (<ColorSpace>)."
"IFD": 1,
"key": "PrimaryChromaticities",
"type": 5
},
"320": { // A color map for palette color images. This field defines a Red-Green-Blue color map (often called a lookup table) for palette-color images. In a palette-color image, a pixel value is used to index into an RGB lookup table.
"IFD": 1,
"key": "ColorMap",
"type": 3
},
"321": { // The purpose of the HalftoneHints field is to convey to the halftone function the range of gray levels within a colorimetrically-specified image that should retain tonal detail.
"IFD": 1,
"key": "HalftoneHints",
"type": 3
},
"322": { // The tile width in pixels. This is the number of columns in each tile.
"IFD": 1,
"key": "TileWidth",
"type": 3
},
"323": { // The tile length (height) in pixels. This is the number of rows in each tile.
"IFD": 1,
"key": "TileLength",
"type": 3
},
"324": { // For each tile, the byte offset of that tile, as compressed and stored on disk. The offset is specified with respect to the beginning of the TIFF file. Note that this implies that each tile has a location independent of the locations of other tiles.
"IFD": 1,
"key": "TileOffsets",
"type": 3
},
"325": { // For each tile, the number of (compressed) byte s in that tile. See TileOffsets for a description of how the byte counts are ordered.
"IFD": 1,
"key": "TileByteCounts",
"type": 3
},
"330": { // Defined by Adobe Corporation to enable TIFF Trees within a TIFF file.
"IFD": 1,
"key": "SubIFDs",
"type": 4
},
"332": { // The set of inks used in a separated (PhotometricInterpretation=5) image.
"IFD": 1,
"key": "InkSet",
"type": 3
},
"333": { // The name of each ink used in a separated (PhotometricInterpretation=5) image.
"IFD": 1,
"key": "InkNames",
"type": 2
},
"334": { // The number of inks. Usually equal to SamplesPerPixel, unless there are extra samples.
"IFD": 1,
"key": "NumberOfInks",
"type": 3
},
"336": { // The component values that correspond to a 0% dot and 100% dot.
"IFD": 1,
"key": "DotRange",
"type": 1
},
"337": { // A description of the printing environment for which this separation is intended.
"IFD": 1,
"key": "TargetPrinter",
"type": 2
},
"338": { // Specifies that each pixel has m extra components whose interpretation is defined by one of the values listed below.
"IFD": 1,
"key": "ExtraSamples",
"type": 3
},
"339": { // This field specifies how to interpret each data sample in a pixel.
"IFD": 1,
"key": "SampleFormat",
"type": 3
},
"340": { // This field specifies the minimum sample value.
"IFD": 1,
"key": "SMinSampleValue",
"type": 3
},
"341": { // This field specifies the maximum sample value.
"IFD": 1,
"key": "SMaxSampleValue",
"type": 3
},
"342": { // Expands the range of the TransferFunction
"IFD": 1,
"key": "TransferRange",
"type": 3
},
"343": { // A TIFF ClipPath is intended to mirror the essentials of PostScript's path creation functionality.
"IFD": 1,
"key": "ClipPath",
"type": 1
},
"344": { // The number of units that span the width of the image, in terms of integer ClipPath coordinates.
"IFD": 1,
"key": "XClipPathUnits",
"type": 8
},
"345": { // The number of units that span the height of the image, in terms of integer ClipPath coordinates.
"IFD": 1,
"key": "YClipPathUnits",
"type": 8
},
"346": { // Indexed images are images where the 'pixels' do not represent color values, but rather an index (usually 8-bit) into a separate color table, the ColorMap.
"IFD": 1,
"key": "Indexed",
"type": 3
},
"347": { // This optional tag may be used to encode the JPEG quantization andHuffman tables for subsequent use by the JPEG decompression process.
"IFD": 1,
"key": "JPEGTables",
"type": 7