diff --git a/utility/exif/94-exif.js b/utility/exif/94-exif.js
index ce9d0c7c..7ea1c6f6 100644
--- a/utility/exif/94-exif.js
+++ b/utility/exif/94-exif.js
@@ -12,6 +12,7 @@ module.exports = function(RED) {
RED.nodes.createNode(this,n);
this.mode = n.mode || "normal";
if (this.mode === "worldmap") { this.property = "payload.content"; }
+ else if (this.mode === "tak") { this.property = "payload.event.detail.image['#text']"; }
else { this.property = n.property || "payload"; }
var node = this;
var ExifReader = require('exifreader');
@@ -81,7 +82,6 @@ module.exports = function(RED) {
else if (node.mode === "worldmap" && (msg.payload.action !== "file" || msg.payload.type.indexOf("image") === -1)) { return; } // in case worldmap-in not filtered.
try {
var value = RED.util.getMessageProperty(msg,node.property);
-
if (value !== undefined) {
if (typeof value === "string") { // it must be a base64 encoded inline image type
if (value.indexOf('data:image') !== -1) {
@@ -91,7 +91,7 @@ module.exports = function(RED) {
value = new Buffer.from(value, 'base64');
}
}
- if (Buffer.isBuffer(value)) { // or a proper jpg buffer
+ if (Buffer.isBuffer(value)) { // or a proper image buffer
msg.exif = ExifReader.load(value);
for (const p in msg.exif) {
if (msg.exif.hasOwnProperty(p)) {
@@ -108,6 +108,10 @@ module.exports = function(RED) {
msg.payload = msg.location || {};
delete msg.location;
}
+ if (node.mode === "tak") {
+ msg.payload.exif = msg.exif || {};
+ delete msg.exif;
+ }
node.send(msg);
}
else {
@@ -121,9 +125,15 @@ module.exports = function(RED) {
}
}
catch (error) {
- node.error("An error occurred while extracting Exif information. Please check the log for details.",msg);
- node.log('Error: '+error.message);
- return;
+ if (node.mode === "tak") {
+ node.send(msg);
+ return;
+ }
+ else {
+ node.error("An error occurred while extracting Exif information. Please check the log for details.",msg);
+ node.log('Error: '+error.message);
+ return;
+ }
}
});
}
diff --git a/utility/exif/README.md b/utility/exif/README.md
index a82aa5e7..a73dd0cb 100644
--- a/utility/exif/README.md
+++ b/utility/exif/README.md
@@ -1,7 +1,7 @@
node-red-node-exif
==================
-A Node-RED node to extract Exif information from JPEG images.
+A Node-RED node to extract Exif information from images.
Install
-------
@@ -17,7 +17,7 @@ This node now uses the more supported exifreader library so that it handles more
Usage
-----
-Extracts Exif information from JPEG images.
+Extracts Exif information from JPEG or WEBP images.
This node expects an incoming JPEG image as a buffer. If Exif data is present, it extracts the data into a `msg.exif` object.
@@ -26,3 +26,5 @@ If the Exif data also contains location information this is extracted as `msg.lo
`msg.payload` retains the original, unmodified image buffer.
You can set it into "worldmap" mode - in this mode the payload contains the "location" data, not the original image, but can be sent directly to a node-red-contrib-worldmap node for visualisation.
+
+Or you can set it into TAK mode - If used with the TAK Ingest node it can extract the exif data from the overall TAK event payload and adds the exif properties to `msg.payload.exif` instead of `msg.exif`.
diff --git a/utility/exif/package.json b/utility/exif/package.json
index 24afa16f..c89862cb 100644
--- a/utility/exif/package.json
+++ b/utility/exif/package.json
@@ -1,6 +1,6 @@
{
"name": "node-red-node-exif",
- "version": "1.1.0",
+ "version": "1.2.0",
"description": "A Node-RED node that extracts Exif information from JPEG image buffers.",
"dependencies": {
"exifreader": "^4.26.1"