mattburns / exiftool.js

A pure javascript implementation of exiftool
MIT License
64 stars 13 forks source link

create and expose getExifFromNodeBuffer #9

Closed dfries closed 9 years ago

dfries commented 10 years ago

Create and expose getExifFromNodeBuffer for when the image is already in a Node.js Buffer, such as a streamed image that isn't even in a file.

Great utility, I coded up a node.js jpeg comment extractor (I've done that before), for a webcam stream, but then figured out it was Exif not a comment, so I looked around and found this. In my case I'm streaming the images over http in one multipart request and so I didn't have a file. Here's a trivial change to modify this module to read an image out of the Node.js Buffer.

I fixed an issue of creating a Buffer of size 100000, reading the file, then creating a BinaryFile of size 1000000 (10x the size). Now it won't create a buffer bigger than 100000, or the buffer length. In my case the images are small, some in the 10KB size, so I didn't want the overhead of creating an image bigger than required.

Thanks for the great work on the module.

Two thoughts. It would be nice to split up the git repository into the large images and testing data, and the small module source itself, and to move the src/* up to the top level. That way I could clone the repository into the node_modules directory without it being huge and it working out of the box so to speak, being a clone it would be easier to update or make changes.

dfries commented 10 years ago

Added another two commits. I found the "Image Description" truncated by a character, and if I quoted the string (in the program making it), it was no longer truncated, but there weren't any quotes, or apostrophes. Fixed both, but why were so many printable ascii characters filtered out?

dfries commented 9 years ago

This pull request is outdated, see #13.