title: Writing a PNG in C++
body: <p>I am trying to write some data to a PNG file using C++ with Visual Studio Express 2013 on Windows 7 64-bit. I understand that to do this, I need to use an external library, but here is where I'm having some difficulty.</p>
  
  <p>I tried using LodePNG - it looked simple, lightweight, and easy to use. The problem is, it was TOO simple, and seems to require data in a certain pixel format that doesn't match what I have. I could modify my data to make it compatible with LodePNG, but I'd much rather use a library such as libpng with a bit more flexibility.</p>
  
  <p>However, I don't understand the first thing about building or linking libraries, and libpng has proved to be an absolute nightmare in this. I tried following <a href="http://blog.morzproject.com/build-static-libpng-using-visual-studio/" rel="nofollow">this guide</a>, and managed to produce "libpng.lib" and "png.h", but when I try to include these in my project (I placed both files in my project directory, added "png.h" to my header files and added "libpng.lib" to the Linker's "Additional Dependencies" field), I got a ton of build errors, notably:</p>
  
  <pre><code>error C1083: Cannot open include file: 'pnglibconf.h': No such file or directory
  </code></pre>
  
  <p>Can anyone please instruct me as to how to install libpng, direct me to a good guide on the subject (I'm amazed by the lack of guides out there...), or recommend a different (lightweight, easy to install) PNG library? I'm going crazy here.</p>