Reading File Metadata with extract and libextractor
Listing 8. jpegextractor.c adds the MIME type to the list after parsing the file header.
if ( (data != 0xFF) || (data != 0xD8) ) return prev; /* not a JPEG */ addKeyword(&prev, strdup("image/jpeg"), EXTRACTOR_MIMETYPE); /* ... more parsing code here ... */ return prev;
libextractor is a simple extensible C library for obtaining metadata from documents. Its plugin architecture and broad support for formats set it apart from format-specific tools. The design is limited by the fact that libextractor cannot be used to update metadata, which more specialized tools typically support.
Resources for this article: /article/8207.
Christian Grothoff graduated from the University of Wuppertal in 2000 with a degree in mathematics. He currently is a PhD student in computer science at Purdue University, studying static program analysis and secure peer-to-peer networking. A Linux user since 1995, he has contributed to various free software projects and now is the maintainer of GNUnet and a member of the core team for libextractor. His home page can be found at grothoff.org/christian.
- Reply to comment | Linux Journal
5 hours 50 min ago
20 hours 17 min ago
- Why choose a Flash based product?
20 hours 54 min ago
1 day 9 hours ago
2 days 1 hour ago
- Thanks for clearing that up.
2 days 6 hours ago
- Nice coding on the cake. I
2 days 18 hours ago
- Baker's identity
2 days 23 hours ago
- Uber jealous
3 days 4 hours ago
- Reality is disapointing
3 days 14 hours ago