diff options
author | Přemysl Eric Janouch <p@janouch.name> | 2021-12-10 16:48:23 +0100 |
---|---|---|
committer | Přemysl Eric Janouch <p@janouch.name> | 2021-12-10 17:23:26 +0100 |
commit | fa15707d9b9aa3590facd6718df336d55f846815 (patch) | |
tree | b05cdc04313b25412e4423589081bd0a5bb071ca /tools/pnginfo.c | |
parent | 16c6766e797e14690805ad6219619d8936ab57e7 (diff) | |
download | fiv-fa15707d9b9aa3590facd6718df336d55f846815.tar.gz fiv-fa15707d9b9aa3590facd6718df336d55f846815.tar.xz fiv-fa15707d9b9aa3590facd6718df336d55f846815.zip |
pnginfo: extract eXIf chunk data
Diffstat (limited to 'tools/pnginfo.c')
-rw-r--r-- | tools/pnginfo.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/tools/pnginfo.c b/tools/pnginfo.c index afb3d50..41ebd9e 100644 --- a/tools/pnginfo.c +++ b/tools/pnginfo.c @@ -15,6 +15,8 @@ // CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. // +#include "info.h" + #include <png.h> #include <jv.h> @@ -143,12 +145,16 @@ extract_chunks(png_structp pngp, png_infop infop) if (png_get_iCCP(pngp, infop, &name, NULL, &profile, &profile_len)) o = jv_object_set(o, jv_string("ICC"), jv_string(name)); + // https://ftp-osl.osuosl.org/pub/libpng/documents/pngext-1.5.0.html#C.eXIf jv set = jv_object(); png_unknown_chunkp unknowns = NULL; int unknowns_len = png_get_unknown_chunks(pngp, infop, &unknowns); - for (int i = 0; i < unknowns_len; i++) + for (int i = 0; i < unknowns_len; i++) { set = jv_object_set(set, jv_string((const char *) unknowns[i].name), jv_true()); + if (!strcmp((const char *) unknowns[i].name, "eXIf")) + o = parse_exif(o, unknowns[i].data, unknowns[i].size); + } jv a = jv_array(); jv_object_keys_foreach(set, key) @@ -227,7 +233,7 @@ error_png: fclose(fp); error: if (err) { - o = jv_object_set(o, jv_string("error"), jv_string(err)); + o = add_error(o, err); free(err); } return o; |