To store the caption in the image, I decided to use the IPTC metadata headers. As a test, I use IrfanView to add a caption in the IPTC data of an image taken by my camera, and put the SD card back. The camera displayed the image normally. Sanity check passed.
Next I looked for a IPTC library in C. libiptcdata seemed to fit the bill, so I got it and tried to integrate it with CHDK. I tried compiling it separately, moved it into CHDK, and neither worked. It gave me trouble with stdarg.
Frustrated, I did a hex dump of the JPEG file. The data format did not look too complicated. I then found an excellent article describing the layout for the IPTC header. Equipped with that, I wrote my own code to extract the caption field out of the IPTC header. And it worked! Very very exciting.
0 Responses to “IPTC parser”