http://blog.csdn.net/xiaozhun07/article/details/49865785

png使用过程问题小结:

(1) libpng “png_set_longjmp_fn” not found

解决方法

In my case, I have the old png 1.2 came with my ubuntu installed in /usr. I installed the 1.6.x in /usr/local. In my make system, the default include /usr/include and linking /usr/lib were picked up. When compiling any software that rely on the new interface, you need to add

CPPFLAGS="-I/usr/local/include $CPPFLAGS"
LDFLAGS="-L/usr/local/lib $LDFLAGS"

this will pick up

grep png_set_longjmp_fn png.h
PNG_EXPORT(8, jmp_buf*, png_set_longjmp_fn, (png_structrp png_ptr,
(*png_set_longjmp_fn((png_ptr), longjmp, (sizeof (jmp_buf))))

In my case, I have the old png 1.2 came with my ubuntu installed in /usr. I installed the 1.6.x in /usr/local. In my make system,

the default include /usr/include and linking /usr/lib were picked up. When compiling any software that rely on the new interface, you need to add

CPPFLAGS="-I/usr/local/include $CPPFLAGS"
LDFLAGS="-L/usr/local/lib $LDFLAGS"

this will pick up

grep png_set_longjmp_fn png.h
PNG_EXPORT(8, jmp_buf*, png_set_longjmp_fn, (png_structrp png_ptr,
(*png_set_longjmp_fn((png_ptr), longjmp, (sizeof (jmp_buf))))

Then
libpng12.so.0 => /lib/x86_64-linux-gnu/libpng12.so.0 (0x00007f8ac214e000)
change to
libpng16.so.16 => /usr/local/lib/libpng16.so.16 (0x00007fc9c273f000)

5.PNG++安装

我们首先安装libpng和zlib

5.1安装libpng和zlib

由于PNG++是基于libpng-1.2.x的版本,所以这里我们下载1.2.53版本
下载地址:
http://sourceforge.net/projects/libpng/files/libpng12/1.2.53/libpng-1.2.53.tar.xz/download

解压后进入文件夹,编译

./configure

make check

sudo make install

make check

sudo ldconfig

5.2安装png++

首先,下载png++0.2.5版本
http://download.savannah.gnu.org/releases/pngpp/
解压后进入文件夹

Issue make to test how it's doing:

$ make

This will compile examples in the example directory. If
everything goes well, try

$ make test

(or make check which is the same as above) to run the
test suite. If tests do not produce error messages then probably all is OK.

Now you can create documentation (optional). Use

$ make docs

to run doxygen in the sources directory.

Now it is time to become root and install png++ into your
system. It's OK to issue make install under ordinary user permissions if you
want to install png++ into your home directory. Run the following command:

$ make install PREFIX=$HOME

to copy png++ header files to ~/include/png++ and
documentation files to ~/share/doc/png++-0.2.x. Without a PREFIX png++ installs
to /usr/local.

随后可以根据http://www.nongnu.org/pngpp/doc/0.2.5/
测试是否安装成功:

#include <png++/png.hpp>

//...

int main()

{

png::image< png::rgb_pixel > image(128, 128);

for (png::uint_32 y = 0; y < image.get_height(); ++y)

{

for (png::uint_32 x = 0; x < image.get_width(); ++x)

{

image[y][x] = png::rgb_pixel(x, y, x + y);

// non-checking equivalent of image.set_pixel(x, y, ...);

}

}

image.write("rgb.png");

return 0;

}

Use the following command to compile your program:

$ g++ -c example.cpp `libpng-config --cflags`

and the following to link it:

$ g++ -o example example.o `libpng-config --ldflags`

运行 example文件

./example

如果能够生成一张图片,说明png++安装成功

相关文档

Main Page
    Namespaces
    Classes
    Files

png++ Documentation

0.2.1
Introduction
This is the documentation for png++ the C++ wrapper for libpng. This page documents png++ version 0.2.1.

Png++ aims to provide simple yet powerful C++ interface to libpng, the PNG reference implementation library. Png++ is free software distributed under a modified variant of BSD license.
News

Added support for tRNS chunk.
    Added non-std IO streams support.
    Fixed 16-bit endianness problems.
    Improved test script.

Getting started
The following code demonstrates how to read and write PNG images using png++:

png::image< png::rgb_pixel > image("input.png");
 image.write("output.png");

The code reads an image from the file named input.png, then writes the image to a file named output.png. The image class template allows you to specify the desired pixel type for the image data. The available pixel types include: RGB, Grayscale and Indexed pixels. Some of the pixel types can have an alpha channel.

The png++ naturally supports reading PNG images of any color type into RGB or Grayscale pixel buffers (with optional alpha channel). This is particularly useful for an image viewer if it needs to display the PNG image on, for example, RGB device regardless of the image color type.

On the other hand one might want to read only images of particular type. With png++ you can specify it this way:

png::image< png::rgb_pixel > image("rgb.png", png::require_color_space< png::rgb_pixel >());

Installing
Png++ comes as a set of header files and does not require compilation to be installed. For the same reason there are no binary packages for png++.
Prerequisites

png++ works with libpng-1.2.x.
    png++ compiles with g++-4.1 and g++-4.2. Other version should work well too.
    png++ relies on GNU make for compiling tests and examples; in particular it uses "remaking makefiles" feature
    Documentation is produced using doxygen. See the bottom of this page for doxygen version used to compile these docs.

Installing png++
Follow these instructions in order to install png++:

Unpack source package:

$ tar -zxf png++-0.2.x.tar.gz -C ~/src

Go to your brand new png++ sources directory:

$ cd ~/src/png++-0.2.x

Issue make to test how it's doing:

$ make

This will compile examples in the example directory. If everything goes well, try

$ make test

(or make check which is the same as above) to run the test suite. If tests do not produce error messages then probably all is OK.
    Now you can create documentation (optional). Use

$ make docs

to run doxygen in the sources directory.
    Now it is time to become root and install png++ into your system. It's OK to issue make install under ordinary user permissions if you want to install png++ into your home directory. Run the following command:

$ make install PREFIX=$HOME

to copy png++ header files to ~/include/png++ and documentation files to ~/share/doc/png++-0.2.x. Without a PREFIX png++ installs to /usr/local.

Working with images
In png++ you can create new images like this:

#include <png++/png.hpp>
 //...
 png::image< png::rgb_pixel > image(128, 128);
 for (size_t y = 0; y < image.get_height(); ++y)
 {
     for (size_t x = 0; x < image.get_width(); ++x)
     {
         image[y][x] = png::rgb_pixel(x, y, x + y);
         // non-checking equivalent of image.set_pixel(x, y, ...);
     }
 }
 image.write("rgb.png");

Optionally, you may specify

image.set_interlace_type(png::interlace_adam7)

to produce an interlaced image.

If you are writing an indexed colors image, you should provide a palette (colormap). One of the ways to do this is the following:

#include <png++/png.hpp>
 //...
 png::image< png::index_pixel > image;
 png::palette pal(256);
 for (size_t i = 0; i < pal.size(); ++i)
 {
     pal[i] = png::color(i, 255 - i, i);
 }
 image.set_palette(pal);
 ...
 image.write("palette.png");

It is not absolutely necessary to have the whole image data in memory in order to write a PNG file. You can use generator class template to write the image row-by-row. An example of this is provided in example/pixel_generator.cpp bundled with the sources package.

The same holds for reading images too. You can use consumer class template in order to read the image data row-by-row. This might help in applications which have to deal with large PNG images but do not want to read the entire image into memory.

You can read or write images from/to generic IO stream, not only file on disk. Check out image::read(std::istream&), image::write(std::ostream&) overloads in the reference manual.
Compiling your programs
Use the following command to compile your program:

$ g++ -c example.cpp `libpng-config --cflags`

and the following to link it:

$ g++ -o example example.o `libpng-config --ldflags`

When compiling you should add -I $PREFIX/include if you have installed png++ to non-standard location, like your home directory.

In your program, the line

#include <png++/png.hpp>

brings in all the header files in png++ which should be suitable for the most of the applications. You may include only the headers you really use, for example:

#include <png++/image.hpp>
 #include <png++/rgb_pixel.hpp>

If do not want to install png++ headers you still can compile your programs. Just create a subdirectory named png++ somewhere in your project tree and copy all of the .hpp files in png++ distribution there. Then use appropriate compiler options to add this directory into the header search path.
Further reading

To get information about specific features, use reference (can be reached from the top of this page).
    If you are looking for more example code, please go to the example/ directory of the source distribution. You may also find sources in the test/ directory insightful (well, somewhat).
    Have a question? Check out Getting help section below.
    Of course, your ultimate source for learning is the source code. :-)

Download
The project is hosted at Savannah: http://savannah.nongnu.org/projects/pngpp/

Released source packages can be found here: http://download.savannah.nongnu.org/releases/pngpp/

Also, you can check out sources directly from SVN repository: svn://svn.sv.nongnu.org/pngpp/trunk/ or http://svn.sv.nongnu.org/pngpp/trunk/ (for people w/o outgoing svn).

Online version of this documentation can be found here: http://www.nongnu.org/pngpp/doc/0.2.1/index.html
Bugs
The following is a list of known bugs and limitations:

Lacks support for output transformations
    Lacks support for optional/unknown chunks in PNG data stream
    Documentation sucks ;-)

To report bugs, please use Savannah bug tracker: http://savannah.nongnu.org/bugs/?group=pngpp&func=additem

Do not forget to check if the bug was already filed. :-)
Getting help
There is a mailing list for developers: http://lists.nongnu.org/mailman/listinfo/pngpp-devel

You can also contact me by dropping a mail to <alex.shulgin@gmail.com>.

Happy hacking!

Alex Shulgin
Generated on Sat Dec 8 13:43:56 2007 for png++ by  doxygen 1.5.3-20071008

Ubuntu libpng png++安装的更多相关文章

  1. Ubuntu 14 编译安装 PHP 5.4.45 + Nginx 1.4.7 + MySQL 5.6.26 笔记

    Ubuntu 14 编译安装 PHP 5.4.45 + Nginx  1.8.0/1.4.7 + MySQL 5.6.26 笔记,主要是给自己的PC机安装,非生产环境! 一.下载必要的源码 1.1.下 ...

  2. ubuntu 14.04 安装torch及编译环境zbstudio

    ubuntu 14.04 安装torch及编译环境zbstudio torch zbstudio 本来是安装官网给的步骤安装torch的,可是碰到一系列的问题,后来参考网上的安装方法安装成功了 官网安 ...

  3. 在Ubuntu|CentOS上安装Shutter截图工具及快捷键设置

    简介 Shutter前身叫GScrot,它是一款相当棒的截图软件. 通过Shutter,你可以截取包括选定区域.全屏幕.窗口.窗口内的控件甚至网页的图像.通过内置的强大插件机制,你可以在截图后,对图像 ...

  4. 解决Bash On Ubuntu On Window安装Zsh无效问题附安装说明

    前言 Zsh是一款非常棒的Shell,使用Linux和Mac系统的人,基本上都知道zsh的存在. 问题 在安装完Zsh后,zsh是可以使用的,但是重启之后,又恢复至默认的bash. 我在安装好之后,使 ...

  5. Torch7在Ubuntu下的安装与配置

    Torch7的本系列教程的主要目的是介绍Torch的入门使用.今天首先分享一下Torch7的安装.(在Ubuntu14.04安装torch7) 为什么选择Torch Torch的目标是在建立科学算法的 ...

  6. 【转】Ubuntu 16.04安装配置TensorFlow GPU版本

    之前摸爬滚打总是各种坑,今天参考这篇文章终于解决了,甚是鸡冻\(≧▽≦)/,电脑不知道怎么的,安装不了16.04,就安装15.10再升级到16.04 requirements: Ubuntu 16.0 ...

  7. Ubuntu 16.04 安装 Kodi v17 “Krypton” Alpha 2

    Ubuntu 16.04 安装 Kodi v17 “Krypton” Alpha 2:sudo add-apt-repository ppa:team-xbmc/xbmc-nightlysudo ap ...

  8. Linux(Ubuntu)下安装NodeJs

    用以下命令来升级系统,并且安装一些Node.JS必要的包. Linux(Ubuntu)下安装NodeJs 安装nodeJS之前,如果没有安装g++ make libssl-dev等, 1.更新系统和依 ...

  9. 在Ubuntu 14.04安装和使用Docker

    Docker是一个开源软件,它可以把一个Linux应用和它所依赖的一切(比如配置文件)都封装到一个容器.然而,Docker与虚拟机不同,它使用了沙箱机制,Docker容器不运行操作系统,它共享主机上的 ...

随机推荐

  1. Javascript的解析器

    Carakan C/C++ http://my.opera.com/core/blog/2009/02... SquirrelFish C++ http://trac.webkit.org/wiki/ ...

  2. Visual studio中后期生成事件命令使用

    在做项目是总要把发布后的一些dll拷贝的根网站的bin目录下,为了避免每次都需要手动拷贝可以在 项目的生成事件中写入bat命令,下面的命令只在项目使用的发布配置时执行拷贝, (在生成->配置管理 ...

  3. Android DataBinding库(MVVM设计模式)

    什么是MVVM 说到DataBinding,就有必要先提起MVVM设计模式.Model–View–ViewModel(MVVM) 是一个软件架构设计模式,相比MVVM,大家对MVC或MVP可能会更加熟 ...

  4. umount: /data: device is busy

    如果一个文件系统处于"busy"状态的时候,不能卸载该文件系统.如下情况将导致文件系统处于"busy"状态:1:文件系统上面有打开的文件2:某个进程的工作目录在 ...

  5. Patterns-Observer

    http://book.javanb.com/java-design-patterns/index.html Java深入到一定程度,就不可避免的碰到设计模式(design pattern)这一概念, ...

  6. 04-maven学习-pom.xml解析

    pom.xml里面各个配置的含义如下: <!-- 主项目标识,表示当前maven属于哪个实际项目,与包是一样的 --> <groupId>反写的公司网址+项目名</gro ...

  7. mysql 如何查看sql语句执行时间

    查看执行时间 1 show profiles; 2 show variables;查看profiling 是否是on状态: 3 如果是off,则 set profiling = 1: 4 执行自己的s ...

  8. 如何使用T-SQL备份还原数据库及c#如何调用执行? C#中索引器的作用和实现。 jquery控制元素的隐藏和显示的几种方法。 localStorage、sessionStorage用法总结 在AspNetCore中扩展Log系列 - 介绍开源类库的使用(一) span<T>之高性能字符串操作实测

    如何使用T-SQL备份还原数据库及c#如何调用执行? 准备材料:Microsoft SQL Server一部.需要还原的bak文件一只 一.备份 数据库备份语句:user master backup ...

  9. 公众号的TOKEN配置PHP代码

    1.在后台添加好URL和TOKEN和生成43位随机码  注意域名URL需要备案 2.上传到服务器 3.公众号后台要点提交即可 error_reporting(0); $signature=$_REQU ...

  10. 温故而知新 $ jquery选择器居然隐藏第二个参数,更进一步限制选择的区域

    $ 选择器的第二个参数 $("[name=" + name + "]", layero); layero 其实也是一个dom对象,譬如一个表单,一个table. ...