From e77b9eaa6c6c62c4fc87e10c2a7491ad9d93a522 Mon Sep 17 00:00:00 2001 From: "freedesktop.mrbax" <freedesktop.mrbax@bugs.freedesktop.org> Date: Sat, 12 Dec 2020 22:08:47 +0100 Subject: [PATCH] pdfimages: Account for rotation in PPI calculation Closes: https://gitlab.freedesktop.org/poppler/poppler/-/issues/3 --- utils/ImageOutputDev.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/utils/ImageOutputDev.cc b/utils/ImageOutputDev.cc index 552a3b15e..4ca2ff9d9 100644 --- a/utils/ImageOutputDev.cc +++ b/utils/ImageOutputDev.cc @@ -227,10 +227,10 @@ void ImageOutputDev::listImage(GfxState *state, Object *ref, Stream *str, int wi } const double *mat = state->getCTM(); - double width2 = mat[0] + mat[2]; - double height2 = mat[1] + mat[3]; - double xppi = fabs(width * 72.0 / width2) + 0.5; - double yppi = fabs(height * 72.0 / height2) + 0.5; + double width2 = sqrt(mat[0] * mat[0] + mat[1] * mat[1]); + double height2 = sqrt(mat[2] * mat[2] + mat[3] * mat[3]); + double xppi = fabs(width * 72.0 / width2); + double yppi = fabs(height * 72.0 / height2); if (xppi < 1.0) printf("%5.3f ", xppi); else -- GitLab