mattburns / exiftool.js

A pure javascript implementation of exiftool
MIT License
64 stars 13 forks source link

Import tag data from exiftool and move it outside of exiftool.js #18

Open fbuchinger opened 9 years ago

fbuchinger commented 9 years ago

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.

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

mattburns commented 9 years ago

Hi Franz, Thanks for this. Your name rung a bell and we actually spoke about this years ago. I just searched my email and saw you even mentioned "exiftool.js" hah! I'd forgotten about that. http://photo.stackexchange.com/questions/1503/what-photo-sharing-websites-expose-camera-serial-numbers#comment12727_8800

Your suggestion is a good one and I'd certainly appreciate any help you can offer.

However, the first bug that must be fixed is https://github.com/mattburns/exiftool.js/issues/8 The test suite is not deterministic which means it cannot be trusted! Once that is reliable, then we can make changes without fear of regression etc.

Have you seen this fork of the project by @redaktor ? https://github.com/redaktor/exiftool.js I'd really like to pull these projects together I'm just always too busy...

Cheers, Matt

fbuchinger commented 9 years ago

Hi Matt,

yeah, I also remembered you from our conversation and of stolencamerafinder.net ;-) Glad to hear that you are still committed to photography and metadata. I hope I can help to land some progress on exiftool.js. I wasn't aware of redaktor's fork, but will certainly investigate it, since he already has done some import of exiftool's tag database.

I will also check your testsuite bug. Unfortunately, the coverage testsuite feels a bit bloated at the moment with approx 7000 images, so its pretty hard to work with it. See my other issue #19 for an improvement suggestion.

Best,

Franz