PNGwriter

  892 downloads
0.5.4 GPL (GNU General Public License)    
4.0/5 1
A C++ library for creating PNG images.

description

download

specifications

changelog

PNGwriter is a C++ library for creating PNG images. PNGwriter lets you focus on your program, and saves you the trouble of learning how to create, use and read PNG images from scratch. You just need to specify what size you want your image, and then you go plotting pixel by pixel in a given colour with the plot function.

PNGwriter was originally written with scientists in mind. The need to create an image from the result of a scientific computer simulation arises as a natural part of scientific programming. Getting the data out of the program and into a high quality image in an efficient way can sometimes be hard, especially if the user is not a very experienced programmer.The methods used can often be highly inefficient or too complex to be good for work.

If the data is in (x, y) form, then one can use any of the many plotting programs out there, like gnuplot, R. Br�hl's excellent Abscissa and so on.

If, on the other hand, the data is in (x, y, z) form, one must choose how to represent the third variable. Software such as Mathematica offers many alternatives in this respect, but if the amount of data points is considerable, rendering an image using Mathematica as an array of pixels using text-based data is many, many times slower than rendering the image to disk from the C++ program itself. Consider the bottlenecks involved: the program must produce a file, writing the data in ASCII mode. This is about two orders of magnitude slower than outputting the data in binary mode. It must then be rendered by Mathematica, using vector graphics (one object per pixel). It is only at this stage that one can convert the image to a lossless bitmap image format such as PNG or TIFF. Another possibility is to use ImageMagick or Netpbm to process the data, but again, one is limited by the fact that the data must be written in ASCII format first, and support for 24-bit colour in the PPM file format is not standardized (i.e., mostly non-existent) and is endian-dependent.

PNGwriter was written as a possible solution to this issue. Its interface is extremely intuitive, there is only one new object to learn about (the PNGwriter class), in other words, no classes and subclasses for pixels, colours, bitmaps, filenames, etc. As long as you know what colour you want the pixel at position (x, y) to be, you can implement any algorithm you want. Want to play with cellular automata but are tired of seeing you results as an array of 1s and 0s in text? Want to have a go at exploring fractals yourself? Need a quick way to implement that image-recognition algorithm you are working on for your autonomous rover, driverless vehicle or robot arm? Want to simulate gravitational lensing but haven't yet been able to create an actual image from your algorithm? Need to simulate an object moving on an energy surface, using interpolation between the available data points? PNGwriter can help!
read more   
Last updated on February 11th, 2009

0 User reviews so far.

SUBMIT