Difference between revisions of "Applications/Libpng"

From HPC
Jump to: navigation , search
m
m
Line 15: Line 15:
 
===Compilation===
 
===Compilation===
  
Libpng is a library for use either with a compiled binary that requires it, or it could be required at compilation time also.
+
'''Libpng''' is a library for use either with a compiled binary that requires it, or it could be required at compilation time also.
  
 
A typical code snippet requiring is shown below:
 
A typical code snippet requiring is shown below:
 +
 +
<pre style="background-color: #f5f5dc; color: black; font-family: monospace, sans-serif;">
  
 
#include <png.h>
 
#include <png.h>
Line 31: Line 33:
 
   ...
 
   ...
  
 +
</pre>
 +
 +
Compilation is carried out below, in this example the '''gcc''' compiler is used. However, the applies similarly to the Intel compiler too.
  
 
<pre style="background-color: #000000; color: white; border: 2px solid black; font-family: monospace, sans-serif;">
 
<pre style="background-color: #000000; color: white; border: 2px solid black; font-family: monospace, sans-serif;">

Revision as of 09:20, 17 March 2017

Application Details

  • Description: libpng is the official PNG reference library. It supports almost all PNG features, this module would be used for application that require png image support..
  • Version: 1.6.25
  • Module: 1.6.25
  • Licence: GNU

Usage Examples

Module

[username@login01 ~]$ module add libpng/1.6.25

Compilation

Libpng is a library for use either with a compiled binary that requires it, or it could be required at compilation time also.

A typical code snippet requiring is shown below:


#include <png.h>
...

int writeImage(char* filename, int width, int height, float *buffer, char* title)
{
   int code = 0;
   FILE *fp = NULL;
   png_structp png_ptr = NULL;
   png_infop info_ptr = NULL;
   png_bytep row = NULL;
   ...

Compilation is carried out below, in this example the gcc compiler is used. However, the applies similarly to the Intel compiler too.


gcc -o makePNG makePNG.c -lm -lpng 



Further Information

http://www.libpng.org