Configuration and use of zlib and libpng
Solstice 2003/04/3
Note: This article excerpted an article on the home page, the original article introduces 1) The format of the wave file, 2) reading the content of the wave file, and displaying the basic information of the file, 3) zlib library installation and simple application, 4) PNG Library libpng installation, 5) Use libpng to generate PNG files, 6) Draw wave file waveforms, here, we only extract three parts: 3, 4, and 5. The source code involved in this article can be downloaded (http://www.chenshuo.com) from my home page ).
Images in PNG format are very popular on the Internet. Almost all browsers support this format. PNG represents Portable Network Graphics-Portable Network Graphics format. Another reason I prefer PNG images is that PNG files can be directly embedded in PDF files generated by latex. PNG is similar to gif, and is a lossless compressed grating image format. Unlike GIF files, you do not have to pay any copyright fee for the software that generates PNG files. Therefore, the unofficial PNG name isPNG's not GIFFunny enough, right?
Although the format of PNG files is not complex, I decided to use a set of ready-made libraries to read and write it. Don't always reinvent the wheel on your own. Let's take a look at how to install and use the official library of PNG files-libpng and zlib. The common Linux systems are equipped with these two libraries, so I only intend to introduce the installation method in windows.
The following example uses the free Borland C ++ compiler 5.5.1 free compiler as an example. Microsoft Visual C ++ has a similar installation method, but I have no conditional testing.