Difference between revisions of "Applications/Libpng"
From HPC
m (Pysdlb moved page Libpng to Applications/Libpng without leaving a redirect) |
m (→Further Information) |
||
| (3 intermediate revisions by the same user not shown) | |||
| Line 7: | Line 7: | ||
==Usage Examples== | ==Usage Examples== | ||
| + | |||
===Module=== | ===Module=== | ||
<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;"> | ||
[username@login01 ~]$ module add libpng/1.6.25 | [username@login01 ~]$ module add libpng/1.6.25 | ||
</pre> | </pre> | ||
| + | |||
| + | ===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: | ||
| + | |||
| + | <pre style="background-color: #f5f5dc; color: black; font-family: monospace, sans-serif;"> | ||
| + | |||
| + | #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; | ||
| + | ... | ||
| + | |||
| + | </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;"> | ||
| + | |||
| + | gcc -o makePNG makePNG.c -lm -lpng | ||
| + | |||
| + | </pre> | ||
| + | |||
| + | |||
| + | |||
| + | |||
==Further Information== | ==Further Information== | ||
| − | [http://www.libpng.org/ http://www.libpng.org] | + | *[http://www.libpng.org/ http://www.libpng.org] |
| + | |||
| + | {{Librariespagenav}} | ||
Latest revision as of 11:07, 16 November 2022
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