From: cristy Date: Thu, 25 Jul 2013 12:00:12 +0000 (+0000) Subject: (no commit message) X-Git-Tag: 7.0.1-0~3482 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=aaf690a9ea604ff00dcb3ff9f06b843782df0637;p=imagemagick --- diff --git a/coders/tiff.c b/coders/tiff.c index 4ebdd2315..e5f5ff0cb 100644 --- a/coders/tiff.c +++ b/coders/tiff.c @@ -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)