1

I'm creating a Raspberry Pi Zero W security camera and am attempting to integrate motion detection using Node.js. Images are being taken with Pi camera module at 8 Megapixels (3280x2464 pixels, roughly 5MB per image).

On a Pi Zero, resources are limited, so loading an entire image from file to Node.js may limit how fast I can capture then evaluate large photographs. Surprisingly, I capture about two 8MB images per second in a background time lapse process and hope to continue to capture the largest sized images roughly once per second at least. One resource that could help with this is extracting the embedded thumbnail from the large image (thumbnail size customizable in raspistill application).

Do you have thoughts on how I could quickly extract the thumbnail from a large image without loading the full image in Node.js? So far I've found a partial answer here. I'm guessing I would manage this through a buffer somehow?

Christopher Stevens
  • 1,214
  • 17
  • 32
  • I found a super fast option from [this blog](https://benjaminhorn.io/code/extracting-thumbnails-from-camera-raw-files-cr2-and-nef-with-php/). `exiv2 -ep1 -l /home/pi/ cam.jpg` very quickly extracts the thumbnail as its own image file (cam-preview1.jpg), faster than exiftools and anything else I could find (didn't find a node-specific option just yet). **If someone wants to wrap this in a promise-based answer that runs the process then loads it in using [jimp](https://www.npmjs.com/package/jimp), I'll give you the points.** – Christopher Stevens Aug 27 '17 at 16:32

0 Answers0