<html>
    <head>
      <base href="https://bugs.freedesktop.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - pdfimages adds a superfluous 0.5 to image ppi shown using -list (patch provided)"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=104861">104861</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>pdfimages adds a superfluous 0.5 to image ppi shown using -list (patch provided)
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>poppler
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>utils
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>poppler-bugs@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>freedesktop.mrbax@spamgourmet.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Adding 0.5 to a double before formatting with "%5.0f" results in a rounding
error.  Presumably it was originally done before truncating to int.


--- utils/ImageOutputDev.cc.old       2018-01-30 16:38:42.179170000 +0200
+++ utils/ImageOutputDev.cc   2018-01-30 16:39:13.506750000 +0200
@@ -234,13 +234,13 @@
   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 xppi = fabs(width*72.0/width2);
+  double yppi = fabs(height*72.0/height2);
   if (xppi < 1.0)
     printf("%5.3f ", xppi);
   else
     printf("%5.0f ", xppi);
   if (yppi < 1.0)
     printf("%5.3f ", yppi);
   else
     printf("%5.0f ", yppi);</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>