From dba40d4d498dc6ac8e0ca519671d9b56249eee7a Mon Sep 17 00:00:00 2001 From: cristy Date: Thu, 25 Mar 2010 18:31:50 +0000 Subject: [PATCH] --- ChangeLog | 3 +++ coders/pdf.c | 20 ++++++++++++++------ coders/ps.c | 12 ++++++++++-- 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6ced81a92..50ea5c57d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2010-03-21 6.6.0-9 Cristy + * Respect the -density option when rendering a Postscript or PDF image. + 2010-03-24 6.6.0-9 Glenn Randers-Pehrson * coders/png.c: Eliminated support of libpng versions older than 1.0.12. * Relocated the new, misplaced png_get_rowbytes() call. diff --git a/coders/pdf.c b/coders/pdf.c index e7ad0d0aa..8514bf40f 100644 --- a/coders/pdf.c +++ b/coders/pdf.c @@ -316,6 +316,9 @@ static Image *ReadPDFImage(const ImageInfo *image_info,ExceptionInfo *exception) double angle; + GeometryInfo + geometry_info; + Image *image, *next, @@ -333,6 +336,9 @@ static Image *ReadPDFImage(const ImageInfo *image_info,ExceptionInfo *exception) trimbox, status; + MagickStatusType + flags; + PointInfo delta; @@ -389,12 +395,6 @@ static Image *ReadPDFImage(const ImageInfo *image_info,ExceptionInfo *exception) delta.y=DefaultResolution; if ((image->x_resolution == 0.0) || (image->y_resolution == 0.0)) { - GeometryInfo - geometry_info; - - MagickStatusType - flags; - flags=ParseGeometry(PSDensityGeometry,&geometry_info); image->x_resolution=geometry_info.rho; image->y_resolution=geometry_info.sigma; @@ -582,6 +582,14 @@ static Image *ReadPDFImage(const ImageInfo *image_info,ExceptionInfo *exception) return((Image *) NULL); } *options='\0'; + if (image_info->density != (char *) NULL) + { + flags=ParseGeometry(image_info->density,&geometry_info); + image->x_resolution=geometry_info.rho; + image->y_resolution=geometry_info.sigma; + if ((flags & SigmaValue) == 0) + image->y_resolution=image->x_resolution; + } (void) FormatMagickString(density,MaxTextExtent,"%gx%g", image->x_resolution,image->y_resolution); if (image_info->page != (char *) NULL) diff --git a/coders/ps.c b/coders/ps.c index d204f5b38..c2f02ccfb 100644 --- a/coders/ps.c +++ b/coders/ps.c @@ -718,10 +718,18 @@ static Image *ReadPSImage(const ImageInfo *image_info,ExceptionInfo *exception) *options='\0'; if ((page.width == 0) || (page.height == 0)) (void) ParseAbsoluteGeometry(PSPageGeometry,&page); - if (image_info->page != (char *) NULL) - (void) ParseAbsoluteGeometry(image_info->page,&page); + if (image_info->density != (char *) NULL) + { + flags=ParseGeometry(image_info->density,&geometry_info); + image->x_resolution=geometry_info.rho; + image->y_resolution=geometry_info.sigma; + if ((flags & SigmaValue) == 0) + image->y_resolution=image->x_resolution; + } (void) FormatMagickString(density,MaxTextExtent,"%gx%g", image->x_resolution,image->y_resolution); + if (image_info->page != (char *) NULL) + (void) ParseAbsoluteGeometry(image_info->page,&page); page.width=(unsigned long) floor(page.width*image->x_resolution/delta.x+0.5); page.height=(unsigned long) floor(page.height*image->y_resolution/delta.y+ 0.5); -- 2.50.1