Extract IPTC information from JPEG using Javascript <p>I'm trying to extract IPTC photo caption information from a JPEG file using Javascript. (I know I can do this server-side, but I'm looking specifically for a Javascript solution.)</p> <p>I found <a href="https://gist.github.com/raw/161494/8b32c671198a24a947ad654c07e7e09b1470724f/Exif%20JS">this script</a>, which extracts EXIF information ... but I'm not sure how to adapt it to grab IPTC data.</p> <p>Are there any existing scripts that offer such functionality? If not, how would you modify the EXIF script to also parse IPTC data?</p> <p><b>UPDATE</b></p> <p>I've modified the EXIF script I linked above. It <i>sorta</i> does what I want, but it's not grabbing the right data 100 percent of the time.</p> <p>After line 401, I added:</p> <pre><code>else if (iMarker == 237) { // 0xED = Application-specific 13 (Photoshop IPTC) if (bDebug) log("Found 0xFFED marker"); return readIPTCData(oFile, iOffset + 4, getShortAt(oFile, iOffset+2, true)-2); } </code></pre> <p>And then elsewhere in the script, I added this function:</p> <pre><code>function readIPTCData(oFile, iStart, iLength) { exif = new Array(); if (getStringAt(oFile, iStart, 9) != "Photoshop") { if (bDebug) log("Not valid Photoshop data! " + getStringAt(oFile, iStart, 9)); return false; } var output = ''; var count = 0; two = new Array(); for (i=0; i&lt;iLength; i++) { if (getByteAt(oFile, iStart + i) == 2 &amp;&amp; getByteAt(oFile, iStart + i + 1) == 120) { var caption = getString2At(oFile, iStart + i + 2, 800); } if (getByteAt(oFile, iStart + i) == 2 &amp;&amp; getByteAt(oFile, iStart + i + 1) == 80) { var credit = getString2At(oFile, iStart + i + 2, 300); } } exif['ImageDescription'] = caption; exif['Artist'] = credit; return exif; } </code></pre> <p>So let me now modify my question slightly. How can the function above be improved?</p>