aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2023-06-05 11:03:34 +0200
committerPřemysl Eric Janouch <p@janouch.name>2023-06-05 15:42:38 +0200
commitb3bc4811720d5d17e6a4d06fc7a328df23645c42 (patch)
treeb7408da428bf971736e1ee25efe8afda60c0afc1 /tools
parenta3745df84bc272ad0240797750b9b6cfe1b39827 (diff)
downloadfiv-b3bc4811720d5d17e6a4d06fc7a328df23645c42.tar.gz
fiv-b3bc4811720d5d17e6a4d06fc7a328df23645c42.tar.xz
fiv-b3bc4811720d5d17e6a4d06fc7a328df23645c42.zip
rawinfo: descend into JPEG thumbnails
Diffstat (limited to 'tools')
-rw-r--r--tools/rawinfo.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/tools/rawinfo.c b/tools/rawinfo.c
index fa36bba..122486f 100644
--- a/tools/rawinfo.c
+++ b/tools/rawinfo.c
@@ -91,11 +91,20 @@ parse_raw(jv o, const uint8_t *p, size_t len)
break;
}
- thumbnails = jv_array_append(thumbnails,
- JV_OBJECT(jv_string("width"), jv_number(item->twidth),
- jv_string("height"), jv_number(item->theight),
- jv_string("flip"), jv_number(item->tflip),
- jv_string("format"), jv_string(format)));
+ jv to = JV_OBJECT(
+ jv_string("width"), jv_number(item->twidth),
+ jv_string("height"), jv_number(item->theight),
+ jv_string("flip"), jv_number(item->tflip),
+ jv_string("format"), jv_string(format));
+
+ if (item->tformat == LIBRAW_INTERNAL_THUMBNAIL_JPEG &&
+ item->toffset > 0 &&
+ (size_t) item->toffset + item->tlength <= len) {
+ to = jv_set(to, jv_string("JPEG"),
+ parse_jpeg(jv_object(), p + item->toffset, item->tlength));
+ }
+
+ thumbnails = jv_array_append(thumbnails, to);
}
libraw_close(iprc);