资源简介
Ubuntu交叉编译OpenCV时需要安装的libpng库,亲测可用。
代码片段和文件信息
#if 0 /* in case someone actually tries to compile this */
/* example.c - an example of using libpng
* Last changed in libpng 1.6.24 [August 4 2016]
* Maintained 1998-2016 Glenn Randers-Pehrson
* Maintained 1996 1997 Andreas Dilger)
* Written 1995 1996 Guy Eric Schalnat Group 42 Inc.)
* To the extent possible under law the authors have waived
* all copyright and related or neighboring rights to this file.
* This work is published from: United States.
*/
/* This is an example of how to use libpng to read and write PNG files.
* The file libpng-manual.txt is much more verbose then this. If you have not
* read it do so first. This was designed to be a starting point of an
* implementation. This is not officially part of libpng is hereby placed
* in the public domain and therefore does not require a copyright notice.
*
* This file does not currently compile because it is missing certain
* parts like allocating memory to hold an image. You will have to
* supply these parts to get it to compile. For an example of a minimal
* working PNG reader/writer see pngtest.c included in this distribution;
* see also the programs in the contrib directory.
*/
/* The simple but restricted approach to reading a PNG file or data stream
* just requires two function calls as in the following complete program.
* Writing a file just needs one function call so long as the data has an
* appropriate layout.
*
* The following code reads PNG image data from a file and writes it in a
* potentially new format to a new file. While this code will compile there is
* minimal (insufficient) error checking; for a more realistic version look at
* contrib/examples/pngtopng.c
*/
#include
#include
#include
#include
#include
#include
int main(int argc const char **argv)
{
if (argc == 3)
{
png_image image; /* The control structure used by libpng */
/* Initialize the ‘png_image‘ structure. */
memset(&image 0 (sizeof image));
image.version = PNG_IMAGE_VERSION;
/* The first argument is the file to read: */
if (png_image_begin_read_from_file(&image argv[1]) != 0)
{
png_bytep buffer;
/* Set the format in which to read the PNG file; this code chooses a
* simple sRGB format with a non-associated alpha channel adequate to
* store most images.
*/
image.format = PNG_FORMAT_RGBA;
/* Now allocate enough memory to hold the image in this format; the
* PNG_IMAGE_SIZE macro uses the information about the image (width
* height and format) stored in ‘image‘.
*/
buffer = malloc(PNG_IMAGE_SIZE(image));
/* If enough memory was available read the image in the desired format
* then write the result out to the new file. ‘background‘ is not
* necessary when reading the image because the alpha channel is
相关资源
- libpng源代码
- [rar文件] libharu2.3.0 (含libhpdf.liblibp
- PNG图片转换工具,针对QT开发中png图片
- libpng-1.6.12.tar.gz
- zlib和libpng源码
- png++库安装指南和代码
- libpng 使用vs调用的原始包
- libpng+zlib 有源代码和已经编译好的d
- libpng的库文件,lib文件,dll文件
- libpng.lib,zlib.lib,libpng16.dll
- libpng-1.0.10rc1.tar.tar
- libpng12-0-1.2.44-7.1.x86_64rpm
- libpng-1.6.16.tar.gz
- 将bmp文件转换为png文件的项目,
- libpng-1.2.56.tar.gz
- libpng 1.6 windows 64位 编译好的lib库
评论
共有 条评论