diff options
author | Albert Astals Cid <aacid@kde.org> | 2021-04-01 17:27:57 +0200 |
---|---|---|
committer | Albert Astals Cid <tsdgeos@yahoo.es> | 2021-04-15 14:36:07 +0000 |
commit | 0e732883671754fff843c9e869bdc43f4ab6d4db (patch) | |
tree | 0003731d3870de6be5f10dfd945dd73d5eba1ea6 | |
parent | b770a55a47278f4104fc410034577cc4ea0434a6 (diff) |
pdftoppm: Fix regression when using single scaleTo
Fixes #1062
-rw-r--r-- | utils/pdftoppm.cc | 11 |
1 files changed, 9 insertions, 2 deletions
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; |