From bbbb98c6af876dcc6cbae814059d75101b5afcf0 Mon Sep 17 00:00:00 2001 From: Till Kamppeter Date: Thu, 17 Feb 2022 17:56:16 +0100 Subject: [PATCH] imagetoraster, imagetopdf: Fixed print-scaling=auto In the imageto... filters with print-scaling=auto the image size was not compared correctly with the page size to switch between fit-to-page for large sizes and no scaling for small sizes. The image size in pixels was compared with the page size in PostScript points (1/72 inch). This commit fixes the comparisons. (manually backported from commit df3b19756dc2c76a0b0cb2fd4ea45a397167af7f) --- filter/imagetopdf.c | 3 +-- filter/imagetoraster.c | 4 +--- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/filter/imagetopdf.c b/filter/imagetopdf.c index 8884b68d7..5355746aa 100644 --- a/filter/imagetopdf.c +++ b/filter/imagetopdf.c @@ -1000,9 +1000,8 @@ main(int argc, /* I - Number of command-line arguments */ pw = ph; ph = tmp; } - if(w>pw||h>ph) { + if (w * 72.0 / img->xppi > pw || h * 72.0 / img->yppi > ph) document_large = 1; - } if((val = cupsGetOption("print-scaling",num_options,options)) != NULL) { if(!strcasecmp(val,"auto")) { diff --git a/filter/imagetoraster.c b/filter/imagetoraster.c index 4c3bf069e..fcc6cb1ef 100644 --- a/filter/imagetoraster.c +++ b/filter/imagetoraster.c @@ -665,10 +665,8 @@ main(int argc, /* I - Number of command-line arguments */ pw = ph; ph = tmp; } - if(w>pw||h>ph) - { + if (w * 72.0 / img->xppi > pw || h * 72.0 / img->yppi > ph) document_large = 1; - } if((val = cupsGetOption("print-scaling",num_options,options)) != NULL) { -- 2.47.3