Diff of /bin/pto2gpano [3e0be4] .. [859714]  Maximize  Restore

Switch to side-by-side view

--- a/bin/pto2gpano
+++ b/bin/pto2gpano
@@ -20,7 +20,6 @@
     $pto->Read ($path_pto) || next;
 
     my $format = undef;
-    $format = 'cylindrical' if $pto->Panorama->{f} == 1;
     $format = 'equirectangular' if $pto->Panorama->{f} == 2;
     next unless $format;
 
@@ -43,7 +42,15 @@
     if ($pto->Panorama->{v} < 360)
     {
         $full_width = int (360 * $full_width / $pto->Panorama->{v});
-        $left += int (($full_width - $width) /2);
+        $left += int (($full_width - $pto->Panorama->{w}) /2);
+    }
+
+    my $vfov = $pto->Panorama->{v} * $pto->Panorama->{h} / $pto->Panorama->{w};
+    my $full_height = $pto->Panorama->{h};
+    if ($vfov < 180)
+    {
+        $full_height = int (180 * $full_height / $vfov);
+        $top += int (($full_height - $pto->Panorama->{h}) /2);
     }
 
     my $path_first = $pto->Image->[0]->Path ($path_pto);
@@ -58,7 +65,7 @@
     $exiftool->SetNewValue ('CroppedAreaImageWidthPixels', $width);
     $exiftool->SetNewValue ('CroppedAreaImageHeightPixels', $height);
     $exiftool->SetNewValue ('FullPanoWidthPixels', $full_width);
-    $exiftool->SetNewValue ('FullPanoHeightPixels', $pto->Panorama->{h});
+    $exiftool->SetNewValue ('FullPanoHeightPixels', $full_height);
     $exiftool->SetNewValue ('FirstPhotoDate', Image::ExifTool::ImageInfo ($path_first)->{DateTimeOriginal}) if -e $path_first;
     $exiftool->SetNewValue ('LastPhotoDate', Image::ExifTool::ImageInfo ($path_last)->{DateTimeOriginal}) if -e $path_last;
     $exiftool->SetNewValue ('SourcePhotosCount', scalar @{$pto->Image});
@@ -89,9 +96,9 @@
 
 https://developers.google.com/panorama/metadata/
 
-This tool assumes that for each project.pto, there is an equivalent project.jpg
-that needs updated metadata.  It also assumes that the original photos are
-available to extract EXIF data info.
+This tool assumes that for each project.pto, there is an equivalent
+equirectangular project.jpg that needs updated metadata.  It also assumes that
+the original photos are available to extract EXIF data info.
 
 =head1 LICENSE