]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Thu, 25 Jul 2013 12:00:12 +0000 (12:00 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Thu, 25 Jul 2013 12:00:12 +0000 (12:00 +0000)
coders/tiff.c

index 4ebdd231511d7a45a681be3b3690fe8721e4d5c5..e5f5ff0cb7bc1f2d47e64670e6dd937dda1e75a5 100644 (file)
@@ -3195,18 +3195,24 @@ static MagickBooleanType WriteTIFFImage(const ImageInfo *image_info,
         (void) TIFFSetField(tiff,TIFFTAG_RESOLUTIONUNIT,(uint16) units);
         (void) TIFFSetField(tiff,TIFFTAG_XRESOLUTION,image->resolution.x);
         (void) TIFFSetField(tiff,TIFFTAG_YRESOLUTION,image->resolution.y);
-        if (((image->page.x > 0) && (image->page.y >= 0)) ||
-            ((image->page.y > 0) && (image->page.x >= 0)))
+        if ((image->page.x < 0) || (image->page.y < 0))
+          (void) ThrowMagickException(exception,GetMagickModule(),CoderError,
+            "TIFF: negative image positions unsupported","%s",image->filename);
+        if ((image->page.x > 0) && (image->resolution.x > 0.0))
+          {
+            /*
+              Set horizontal image position.
+            */
+            (void) TIFFSetField(tiff,TIFFTAG_XPOSITION,(float) image->page.x/
+              image->resolution.x);
+          }
+        if ((image->page.y > 0) && (image->resolution.y > 0.0))
           {
             /*
-              Set image position.
+              Set vertical image position.
             */
-            if (image->resolution.x != 0.0)
-              (void) TIFFSetField(tiff,TIFFTAG_XPOSITION,(float) image->page.x/
-               image->resolution.x);
-            if (image->resolution.y != 0.0)
-              (void) TIFFSetField(tiff,TIFFTAG_YPOSITION,(float) image->page.y/
-                image->resolution.y);
+            (void) TIFFSetField(tiff,TIFFTAG_YPOSITION,(float) image->page.y/
+              image->resolution.y);
           }
       }
     if (image->chromaticity.white_point.x != 0.0)