Skip to content

Instantly share code, notes, and snippets.

@shoorick
Created May 11, 2010 18:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shoorick/397650 to your computer and use it in GitHub Desktop.
Save shoorick/397650 to your computer and use it in GitHub Desktop.
Print out GPS coordinates from images
#!/usr/bin/perl -wl
use strict;
=head1 DESCRIPTION
Print out GPS coordinates from images
=head1 AUTHOR
Alexander Sapozhnikov
L<http://shoorick.ru/>
L<< E<lt> shoorick at cpan.org E<gt> >>
=cut
use Image::ExifTool qw(:Public);
foreach my $file ( @ARGV ) {
my $info = ImageInfo($file);
my @gps = ( $$info{'GPSLatitude'}, $$info{'GPSLongitude'} );
print $file, ' - ', join( q{,}, map { &convert } @gps ), ' < ', join( q{,}, @gps );
} # foreach
sub convert {
return '?'
unless /(\d+) deg (\d+)' ([\d\.]+)"/;
my $coord = $1 + $2/60 + $3/3600;
$coord = -$coord
if /[WS]$/;
return $coord;
} # sub convert
@shoorick
Copy link
Author

Выводит сохранённые в EXIF географические координаты у изображений, переданных в качестве аргументов.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment