[poppler] utils/pdftoppm.cc

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Apr 15 14:46:55 UTC 2021


 utils/pdftoppm.cc |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

New commits:
commit 0e732883671754fff843c9e869bdc43f4ab6d4db
Author: Albert Astals Cid <aacid at kde.org>
Date:   Thu Apr 1 17:27:57 2021 +0200

    pdftoppm: Fix regression when using single scaleTo
    
    Fixes #1062

diff --git a/utils/pdftoppm.cc b/utils/pdftoppm.cc
index a5f66df3..3e889b9c 100644
--- a/utils/pdftoppm.cc
+++ b/utils/pdftoppm.cc
@@ -630,9 +630,16 @@ int main(int argc, char *argv[])
 
         // Handle requests for specific image size
         if (scaleTo != 0) {
-            resolution = (72.0 * scaleTo) / (pg_w > pg_h ? pg_w : pg_h);
+            if (pg_w > pg_h) {
+                resolution = (72.0 * scaleTo) / pg_w;
+                pg_w = scaleTo;
+                pg_h = pg_h * (resolution / 72.0);
+            } else {
+                resolution = (72.0 * scaleTo) / pg_h;
+                pg_h = scaleTo;
+                pg_w = pg_w * (resolution / 72.0);
+            }
             x_resolution = y_resolution = resolution;
-            pg_w = pg_h = scaleTo;
         } else {
             if (x_scaleTo > 0) {
                 x_resolution = (72.0 * x_scaleTo) / pg_w;


More information about the poppler mailing list