@@ -429,8 +429,8 @@ is available.
429429### Exif parser
430430
431431If you include the Load Image Exif Parser extension, the argument passed to the
432- callback for ` parseMetaData ` will contain the additional properties if Exif data
433- could be found in the given image:
432+ callback for ` parseMetaData ` will contain the following additional properties if
433+ Exif data could be found in the given image:
434434
435435- ` exif ` : The parsed Exif tags
436436- ` exifOffsets ` : The parsed Exif tag offsets
@@ -451,26 +451,82 @@ var orientation = data.exif.get('Orientation')
451451var orientationOffset = data .exifOffsets .get (' Orientation' )
452452```
453453
454- By default, the only available mapped names are ` Orientation ` and ` Thumbnail ` .
454+ By default, only the following names are mapped:
455+
456+ - ` Orientation `
457+ - ` Thumbnail `
458+ - ` Exif `
459+ - ` GPSInfo `
460+ - ` Interoperability `
461+
455462If you also include the Load Image Exif Map library, additional tag mappings
456- become available, as well as two additional methods, ` exif.getText() ` and
457- ` exif.getAll() ` :
463+ become available, as well as three additional methods:
464+
465+ - ` exif.getText() `
466+ - ` exif.getName() `
467+ - ` exif.getAll() `
458468
459469``` js
460470var flashText = data .exif .getText (' Flash' ) // e.g.: 'Flash fired, auto mode',
461471
472+ var name = data .exif .getName (0x0112 ) // Orientation
473+
462474// A map of all parsed tags with their mapped names/text as keys/values:
463475var allTags = data .exif .getAll ()
464476```
465477
466478The Exif parser also adds additional options for the parseMetaData method, to
467479disable certain aspects of the parser:
468480
469- - ` disableExif ` : Disables Exif parsing.
470- - ` disableExifThumbnail ` : Disables parsing of the Exif Thumbnail.
471- - ` disableExifSub ` : Disables parsing of the Exif Sub IFD.
472- - ` disableExifGps ` : Disables parsing of the Exif GPS Info IFD.
473- - ` disableExifOffsets ` : Disables storing Exif tag offsets
481+ - ` disableExif ` : Disables Exif parsing when ` true ` .
482+ - ` disableExifThumbnail ` : Disables parsing of Thumbnail data when ` true ` .
483+ - ` disableExifOffsets ` : Disables storing Exif tag offsets when ` true ` .
484+ - ` includeExifTags ` : A map of Exif tags to include for parsing (includes all but
485+ the excluded tags by default).
486+ - ` excludeExifTags ` : A map of Exif tags to exclude from parsing (defaults to
487+ exclude ` Exif ` ` MakerNote ` ).
488+
489+ An example parsing only Orientation, Thumbnail and ExifVersion tags:
490+
491+ ``` js
492+ loadImage .parseMetaData (
493+ fileOrBlob,
494+ function (data ) {
495+ console .log (' Exif data: ' , data .exif )
496+ },
497+ {
498+ includeExifTags: {
499+ 0x0112 : true , // Orientation
500+ 0x0201 : true , // JPEGInterchangeFormat (Thumbnail data offset)
501+ 0x0202 : true , // JPEGInterchangeFormatLength (Thumbnail data length)
502+ 0x8769 : {
503+ // ExifIFDPointer
504+ 0x9000 : true // ExifVersion
505+ }
506+ }
507+ }
508+ )
509+ ```
510+
511+ An example excluding ` Exif ` ` MakerNote ` and ` GPSInfo ` :
512+
513+ ``` js
514+ loadImage .parseMetaData (
515+ fileOrBlob,
516+ function (data ) {
517+ console .log (' Exif data: ' , data .exif )
518+ },
519+ {
520+ excludeExifTags: {
521+ 0x8769 : {
522+ // ExifIFDPointer
523+ 0x927c : true // MakerNote
524+ },
525+ 0x8825 : true // GPSInfoIFDPointer
526+ }
527+ }
528+ )
529+ ```
474530
475531### Exif writer
476532
@@ -498,37 +554,87 @@ loadImage(
498554### IPTC parser
499555
500556If you include the Load Image IPTC Parser extension, the argument passed to the
501- callback for ` parseMetaData ` will contain the additional property ` iptc ` if IPTC
502- data could be found in the given image.
557+ callback for ` parseMetaData ` will contain the following additional properties if
558+ IPTC data could be found in the given image:
559+
560+ - ` iptc ` : The parsed IPTC tags
561+ - ` iptcOffsets ` : The parsed IPTC tag offsets
562+
503563The ` iptc ` object stores the parsed IPTC tags:
504564
505565``` js
506- var objectname = data .iptc [0x5 ]
566+ var objectname = data .iptc [5 ]
507567```
508568
509- It also provides an ` iptc. get()` method to retrieve the tag value via the tag's
510- mapped name:
569+ The ` iptc ` and ` iptcOffsets ` objects also provide a ` get() ` method to retrieve
570+ the tag value/offset via the tag's mapped name:
511571
512572``` js
513573var objectname = data .iptc .get (' ObjectName' )
514574```
515575
516- By default, the only available mapped names are ` ObjectName ` .
576+ By default, only the following names are mapped:
577+
578+ - ` ObjectName `
579+
517580If you also include the Load Image IPTC Map library, additional tag mappings
518- become available, as well as two additional methods, ` iptc.getText() ` and
519- ` iptc.getAll() ` :
581+ become available, as well as three additional methods:
582+
583+ - ` iptc.getText() `
584+ - ` iptc.getName() `
585+ - ` iptc.getAll() `
520586
521587``` js
522588var keywords = data .iptc .getText (' Keywords' ) // e.g.: ['Weather','Sky']
523589
590+ var name = data .iptc .getName (5 ) // ObjectName
591+
524592// A map of all parsed tags with their mapped names/text as keys/values:
525593var allTags = data .iptc .getAll ()
526594```
527595
528596The IPTC parser also adds additional options for the parseMetaData method, to
529597disable certain aspects of the parser:
530598
531- - ` disableIptc ` : Disables IPTC parsing.
599+ - ` disableIptc ` : Disables IPTC parsing when true.
600+ - ` disableIptcOffsets ` : Disables storing IPTC tag offsets when ` true ` .
601+ - ` includeIptcTags ` : A map of IPTC tags to include for parsing (includes all but
602+ the excluded tags by default).
603+ - ` excludeIptcTags ` : A map of IPTC tags to exclude from parsing (defaults to
604+ exclude ` ObjectPreviewData ` ).
605+
606+ An example parsing only the ` ObjectName ` tag:
607+
608+ ``` js
609+ loadImage .parseMetaData (
610+ fileOrBlob,
611+ function (data ) {
612+ console .log (' IPTC data: ' , data .iptc )
613+ },
614+ {
615+ includeIptcTags: {
616+ 5 : true // ObjectName
617+ }
618+ }
619+ )
620+ ```
621+
622+ An example excluding ` ApplicationRecordVersion ` and ` ObjectPreviewData ` :
623+
624+ ``` js
625+ loadImage .parseMetaData (
626+ fileOrBlob,
627+ function (data ) {
628+ console .log (' IPTC data: ' , data .iptc )
629+ },
630+ {
631+ excludeIptcTags: {
632+ 0 : true , // ApplicationRecordVersion
633+ 202 : true // ObjectPreviewData
634+ }
635+ }
636+ )
637+ ```
532638
533639## License
534640
0 commit comments