<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 - image::save() generates corrupted images on Windows"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=102494">102494</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>image::save() generates corrupted images on Windows
          </td>
        </tr>

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

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

        <tr>
          <th>Hardware</th>
          <td>Other
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows (All)
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>major
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>cpp frontend
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>jeroen@berkeley.edu
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Rendering pdf pages on Windows works great but saving the rendered image using
image.save() creates corrupted files. 

I tried both saving to 'png' and 'jpg' and both images were broken. Exactly the
same code works fine on MacOS and Linux. It looks like the image files are
truncated on Windows. Perhaps the file doesn't get closed properly?

    page_renderer pr;
    pr.set_render_hint(page_renderer::antialiasing, true);
    pr.set_render_hint(page_renderer::text_antialiasing, true);
    image img = pr.render_page(p, dpi, dpi);
    if(!img.is_valid())
      throw std::runtime_error("PDF rendering failure.");
    if(!img.save(filename, format, dpi))
      throw std::runtime_error("Failed to save file" + filename);

I am using poppler 0.57.0 on mingw-w64/gcc 4.9.3 but I have been able to
reproduce this problem with all other versions of poppler and mingw-w64.</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>