Sobesednik / node-exiftool

A Node.js interface to exiftool command-line application.
MIT License
91 stars 15 forks source link

Specify coordinates format #40

Open mirkods opened 6 years ago

mirkods commented 6 years ago

Hi there, i was looking for a way to change the coordinates format and I according with this https://github.com/Sobesednik/node-exiftool/issues/38 my code is the following:

const args = ['c %.8f degrees', 'GPSPosition', 'GPSLongitude', 'GPSLatitude', 'GPSAltitude'];
ep.open()
    .then(() => ep.readMetadata(bufferStream, args))

The output is

{ data: 
       [ { SourceFile: '/var/folders/_5/1yy3l2ms1kl55cv30v02hldh0000gn/T/wrote-55303.data',
           GPSPosition: '"48.88555555 N, "2.34027777 E',
           GPSLongitude: '"2.34027777 E',
           GPSLatitude: '"48.88555555 N' 
       } ],
      error: 'File not found: degrees"\n    1 image files read\n    1 files could not be read' 
}

Basically the format is correctly parsed but I don't understand what the error key means. What do you think about?

Cheers, Mirko

z-vr commented 6 years ago

@mirkods hi, I think what happens is that the first arg gets split by the space, so the degrees is treated is a file. I'll need to allow to prevent this from happening https://github.com/Sobesednik/node-exiftool/blob/master/src/index.js#L123.

Sorry in this module the args splitting could definitely be improved. It will be fixed in the next version -- in the meantime what would your command look like if you were doing it from the CLI?

mirkods commented 6 years ago

In this moment I removed the degrees word in the format and it works well. Anyway my CLI command was something like this:

exiftool -c "%.8f degrees" test.jpeg

Mirko