+-------------------+----------------------------------------------------------+ | Title | libpnmio (I/O PNM library) | +-------------------+----------------------------------------------------------+ | Author | Nikolaos Kavvadias 2012, 2013, 2014, 2015, 2016, 2017, | 2018, 2019, 2020, 2021, 2022 | +-------------------+----------------------------------------------------------+ | Contact | nikolaos.kavvadias@gmail.com | +-------------------+----------------------------------------------------------+ | Website | http://www.nkavvadias.com | +-------------------+----------------------------------------------------------+ | Release Date | 19 February 2022 | +-------------------+----------------------------------------------------------+ | Version | 1.2.7 | +-------------------+----------------------------------------------------------+ | Rev. history | +-------------------+----------------------------------------------------------+ | v1.2.7 | 2022-02-19 | |||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Fixed issues 5 and 6 |
+-------------------+----------------------------------------------------------+ | v1.2.6 | 2016-03-10 |
---|---|---|
Add sftbyvec.c, related changes. |
+-------------------+----------------------------------------------------------+ | v1.2.5 | 2014-10-28 |
---|---|---|
Fixed bugs in PFM format I/O. |
+-------------------+----------------------------------------------------------+ | v1.2.4 | 2014-10-28 |
---|---|---|
Added names to prototype parameters. |
+-------------------+----------------------------------------------------------+ | v1.2.3 | 2014-10-28 |
---|---|---|
Documentation update; add get_pnm_type and reference |
||
to the IrfanView image viewer. |
+-------------------+----------------------------------------------------------+ | v1.2.2 | 2014-10-26 |
---|---|---|
- New test application, rnwimg for reading and |
||
writing PBM, PGM, PPM and PFM images. | ||
- Numerous bug fixes to read_p*m_header routines. |
||
- Added get_pnm_type . |
||
- Removed squares.binary.pgm (all-black image). |
||
- Removed feep.ascii.ppm (incomplete image). |
||
- PFM reading still needs work. |
+-------------------+----------------------------------------------------------+ | v1.2.1 | 2014-10-25 |
---|---|---|
Added sample PBM, PGM, PPM and PFM images for testing. |
+-------------------+----------------------------------------------------------+ | v1.2.0 | 2014-10-25 |
---|---|---|
Added support for reading and writing PFM (Portable Float | ||
Map) image data files. |
+-------------------+----------------------------------------------------------+ | v1.1.1 | 2014-10-01 |
---|---|---|
Date notation change. |
+-------------------+----------------------------------------------------------+ | v1.1.0 | 2014-09-23 |
---|---|---|
Moved AUTHORS, LICENSE, README, VERSION to top-level. |
+-------------------+----------------------------------------------------------+ | v1.0.1 | 2014-06-14 |
---|---|---|
Changed README to README.rst. |
+-------------------+----------------------------------------------------------+ | v1.0.0 | 2014-02-20 |
---|---|---|
First public release. |
+-------------------+----------------------------------------------------------+
.. _XnView: http://www.xnview.com .. _Imagine: http://www.nyam.pe.kr/ .. _PNM: http://en.wikipedia.org/wiki/Netpbm_format .. _PBM: http://netpbm.sourceforge.net/doc/pbm.html .. _PGM: http://netpbm.sourceforge.net/doc/pgm.html .. _PPM: http://netpbm.sourceforge.net/doc/ppm.html .. _PFM: http://netpbm.sourceforge.net/doc/pfm.html .. _PFM page by Paul Bourke: http://paulbourke.net/dataformats/pbmhdr/ .. _Paul Debevec: http://www.pauldebevec.com/Research/HDR/ .. _IrfanView: http://www.irfanview.com
The libpnmio
library provides an implementation and API for reading
and writing PNM (some times termed as Portable AnyMap) images. The PNM
convention is collectively used to address PBM (Portable Bitmap), PGM
(Portable Greymap) and PPM_ (Portable Pixmap) images.
The current version of libpnmio
supports the ASCII variation of the
PNM formats, however, it will be extended in order to support the
corresponding binary formats.
The library is accompanied by the following test applications:
randimg
: produces PBM/PGM/PPM image files filled with random datadoset
: generates a color illustration of the Mandelbrot setrnwimg
: reads and writes PBM/PGM/PPM/PFM images for testing the librarysftbyvec
: reads an input ASCII PGM image, shifts its contents by a
given vector and then writes it back.Since version 1.2.0, support for the Portable Float Map format (PFM_) has been added.
Additional information on the PFM format can be found at the
PFM page by Paul Bourke
_.
Reference documentation for LIBPNMIO can be found in the /doc
subdirectory
in plain text, HTML and PDF form.
The libpnmio
distribution includes the following files:
+-----------------------+------------------------------------------------------+
| /libpnmio | Top-level directory |
+-----------------------+------------------------------------------------------+
| AUTHORS | List of authors. |
+-----------------------+------------------------------------------------------+
| LICENSE | License agreement (modified BSD license). |
+-----------------------+------------------------------------------------------+
| README.rst | This file. |
+-----------------------+------------------------------------------------------+
| README.html | HTML version of README.rst. |
+-----------------------+------------------------------------------------------+
| README.pdf | PDF version of README.rst. |
+-----------------------+------------------------------------------------------+
| VERSION | Current version of the LIBPNMIO distribution. |
+-----------------------+------------------------------------------------------+
| rst2docs.sh | Shell script for generating the documentation using |
| | docutils
. |
+-----------------------+------------------------------------------------------+
| /bin | Executables directory (initially empty) |
+-----------------------+------------------------------------------------------+
| /images | Image data (PBM, PGM, PPM, PFM) for testing |
+-----------------------+------------------------------------------------------+
| *.pbm, *.pgm, | Sample images. |
| *.ppm, *.pfm | |
+-----------------------+------------------------------------------------------+
| /lib | Compiled static library directory |
+-----------------------+------------------------------------------------------+
| /src | Source code directory |
+-----------------------+------------------------------------------------------+
| Makefile | Makefile for compiling the library and generating |
| | the executables. |
+-----------------------+------------------------------------------------------+
| doset.c | Generates a color visualization of the Mandelbrot |
| | set. |
+-----------------------+------------------------------------------------------+
| pnmio.c | Implementation of the libpnmio
library in C. |
+-----------------------+------------------------------------------------------+
| pnmio.h | Header file (interface) of the libpnmio
library. |
+-----------------------+------------------------------------------------------+
| randimg.c | Random PBM/PGM/PPM/PFM image generator. |
+-----------------------+------------------------------------------------------+
| rnwimg.c | Reads and writes PBM/PGM/PPM/PFM images for |
| | exercising the libpnmio
API. |
+-----------------------+------------------------------------------------------+
| sftbyvec.c | Read an input ASCII PGM image, shift its contents by |
| | a given vector and then writes it back |
+-----------------------+------------------------------------------------------+
| /test | Test script directory |
+-----------------------+------------------------------------------------------+
| run-doset.sh | Bash script for running the Mandelbrot set example. |
+-----------------------+------------------------------------------------------+
| run-randimg.sh | Bash script for running the random image generator. |
+-----------------------+------------------------------------------------------+
| run-rnwimg.sh | Bash script for running the read-and-write API tests.|
+-----------------------+------------------------------------------------------+
| run-sftbyvec.sh | Bash script for running the shift-by-vector tests. |
+-----------------------+------------------------------------------------------+
The original sources for the images included in the /libpnmio/images
directory are the following:
prague, squares, lena32, fruit, blocks
letter_j, feep, ppmex255.ascii, ppmex1
haus
ppmex255.binary
This section summarizes the intended functionality of the functions supported
by the libpnmio
application programming interface.
| int get_pnm_type(FILE *f);
Read the header contents of a PBM/PGM/PPM/PFM file up to the point of extracting its type. Valid types for a PNM image are as follows:
PBM_ASCII
= 1PGM_ASCII
= 2PPM_ASCII
= 3PBM_BINARY
= 4PGM_BINARY
= 5PPM_BINARY
= 6PAM
= 7 (unimplemented)PFM_RGB
= 16 PFM_GREYSCALE
= 17The result (pnm_type) is returned.
| int read_pbm_header(FILE *f, int *img_xdim, int *img_ydim, int is_ascii);
Read the header contents of a PBM (portable bit map) file. A PBM image file follows the format:
::
P1