From c872067c44b8d5e236e866a3bc94f0d65fd5c379 Mon Sep 17 00:00:00 2001
From: Andreas Schenk <andreas_schenk@hms.harvard.edu>
Date: Fri, 2 Mar 2012 12:25:26 -0500
Subject: [PATCH] changed tiff io to only write positive origins (negative
 origins are unfortunately not supported by the tiff library)

---
 modules/io/src/img/map_io_tiff_handler.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/modules/io/src/img/map_io_tiff_handler.cc b/modules/io/src/img/map_io_tiff_handler.cc
index b10507243..0f418bc89 100644
--- a/modules/io/src/img/map_io_tiff_handler.cc
+++ b/modules/io/src/img/map_io_tiff_handler.cc
@@ -311,7 +311,7 @@ void MapIOTiffHandler::do_export(const img::MapHandle& image,TIFF* tfile,TIF& fo
   img::Point ori=image.GetSpatialOrigin();
   geom::Vec3 sampling=image.GetPixelSampling();
   float xreso=sampling[0]/Units::cm,yreso=sampling[1]/Units::cm;
-  float xpos=xreso*ori[0],ypos=yreso*ori[1];
+  float xpos=std::max<Real>(0.0,xreso*ori[0]),ypos=std::max<Real>(0.0,yreso*ori[1]); //tiff file format only allows positivie origins, negative origins are lost here
   TIFFSetField(tfile,TIFFTAG_IMAGEWIDTH,width);
   TIFFSetField(tfile,TIFFTAG_IMAGELENGTH,height);
   TIFFSetField(tfile,TIFFTAG_SAMPLESPERPIXEL,spp);
-- 
GitLab