pngexifinfo: PNG-EXIF info lister (Python code)
Cosmin Truta <[email protected]>
| Newsgroups | gmane.comp.graphics.png.general |
|---|---|
| Message-ID | <CAAoVtZyeFAOfSjJHcac7hTy1muLA81XP3ZGuZ0EnwZCmZcUS1w@mail.gmail.com> |
Hi, I posted my current *draft* PNG-EXIF info lister at https://bitbucket.org/ctruta/pngexifinfo It can handle all of eXIf/exIf/zxIf, all of compressed or uncompressed streams (with automatic detection based on signature), with or without uncompressed-length field (also with automatic detection). The automatic compression detection is quick-and-dirty, but in theory works well. The code is otherwise written using clean, idiomatic, PEP8-style Python code. Should any of the current eXIf proposal pass, the code will be updated to match the approved proposal only, and the above-mentioned detection of compression (or lack of compression) will be removed. Here are a few metrics: Total lines of code: 177+248+54 = 479. This includes *everything*. The number of EXIF tags being recognized: 79. (I just stopped randomly, they became too many, and I don't have more time for that right now.) Each tag takes 1 LOC. The TIFF/EXIF parser and lister: 247 LOC. That includes the above-mentioned 79 enumerated tags. The PNG parser, simple, from-scratch: 177 LOC. That includes command-line parsing (incl. help screen), CRC checking, automatic detection of compression, execution of decompression (if needed), and error reporting. The EXIF extraction code out of PNG (both compressed and uncompressed, with and without uncompressed-length field): 21 LOC. The verification and error reporting of uncompressed-length field: 5 LOC. (If this field would not have existed, this would have been 0 LOC.) The decompression of deflate-encoded EXIF data: 1 LOC. Sincerely, Cosmin ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot