Print out GPS coordinates from images
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Выводит сохранённые в EXIF географические координаты у изображений, переданных в качестве аргументов.