Hi Matt,
first of all congratulations to your great effort of porting exiftool to Javascript! Can't wait to see more progress on this project. Just a quick idea from my side: why don't you import the tag data (i.e. name, data structure, meaning of a tag) from exiftool instead of hard-coding it in your source code?
I see a few advantages of this approach:
- additional tags from the database could rapidly increase the tag coverage from exiftool.js.
- you make sure to match all possible values for a tag are matched (e.g. all possible keys/meanings for the compression tag - see below)
- you get tag translations in 10 languages for free.
How to do it?
exiftool provides the -listx option to dump out (parts of) its tag database to xml, e.g.
exiftool -listx -EXIF:All
would dump out all exif tag info in an xml structure like this:
<?xml version='1.0' encoding='UTF-8'?>
<taginfo>
<table name='Exif::Main' g0='EXIF' g1='IFD0' g2='Image'>
<desc lang='en'>Exif</desc>
<desc lang='it'>Exif</desc>
<!-- some tags omitted - tag id = decimal version of hex identifier of tag (0x0103 == 259)-->
<tag id='259' name='Compression' type='int16u' writable='true'>
<desc lang='en'>Compression</desc>
<desc lang='cs'>Kompresní algoritmus</desc>
<desc lang='de'>Komprimierungsschema</desc>
<desc lang='es'>Compresión</desc>
<desc lang='fi'>Pakkausskeema</desc>
<desc lang='fr'>Schéma de compression</desc>
<desc lang='it'>Compressione</desc>
<desc lang='ja'>圧縮計画</desc>
<desc lang='ko'>압축 설계</desc>
<desc lang='nl'>Compressie schema</desc>
<desc lang='pl'>Algorytm kompresji</desc>
<desc lang='ru'>Схема сжатия</desc>
<desc lang='sv'>Komprimeringsschema</desc>
<desc lang='tr'>Sıkıştırma planı</desc>
<desc lang='zh_cn'>压缩方案</desc>
<desc lang='zh_tw'>壓縮方式</desc>
<values>
<!-- key id maps a numerical tag value to an explanation-->
<key id='1'>
<val lang='en'>Uncompressed</val>
<val lang='cs'>Bez komprese</val>
<val lang='de'>Nicht komprimiert</val>
<val lang='es'>Sin comprimir</val>
<val lang='fr'>Non compressé</val>
<val lang='it'>Non compresso</val>
<val lang='ja'>非圧縮</val>
<val lang='ko'>무압축</val>
<val lang='nl'>Niet gecomprimeerd</val>
<val lang='pl'>Bez kompresji</val>
<val lang='ru'>без сжатия</val>
<val lang='sv'>Ingen komprimering</val>
<val lang='tr'>Sıkıştırılmamış</val>
<val lang='zh_cn'>未压缩</val>
<val lang='zh_tw'>未壓縮</val>
</key>
<key id='2'>
<val lang='en'>CCITT 1D</val>
</key>
<key id='3'>
<val lang='en'>T4/Group 3 Fax</val>
<val lang='it'>Fax T4/Group 3</val>
</key>
<key id='4'>
<val lang='en'>T6/Group 4 Fax</val>
<val lang='it'>Fax T6/Group 4</val>
</key>
<key id='5'>
<val lang='en'>LZW</val>
</key>
<!-- some keys omitted-->
</values>
</tag>
</table>
</taginfo>
Obviously one would then have to convert the xml file into multiple JSON files (maybe a default one in English, plus some separate i18n files for the other languages). Finally you have to enhance your Exif parser to understand the format of the JSON files.
In case you are interested I can try to compile a pull request.
Best,
Franz
Hi Matt,
first of all congratulations to your great effort of porting exiftool to Javascript! Can't wait to see more progress on this project. Just a quick idea from my side: why don't you import the tag data (i.e. name, data structure, meaning of a tag) from exiftool instead of hard-coding it in your source code?
I see a few advantages of this approach:
How to do it?
exiftool provides the -listx option to dump out (parts of) its tag database to xml, e.g.
would dump out all exif tag info in an xml structure like this:
Obviously one would then have to convert the xml file into multiple JSON files (maybe a default one in English, plus some separate i18n files for the other languages). Finally you have to enhance your Exif parser to understand the format of the JSON files.
In case you are interested I can try to compile a pull request.
Best,
Franz