libpnm - libnetpbm functions to read and write PNM image files
Contents
Description
These library functions are part of Netpbm(1).
TYPESANDCONSTANTS
Each xel contains three xelvals, each of which should contain only the values between 0 and
PNM_MAXMAXVAL, inclusive.
XELMANIPULATIONS
The PNM_GET1 macro extracts a single value from an xel, when ou know it's from a PBM or PGM file. When
it's from a PPM file, use PPM_GETR(), PPM_GETG(), and PPM_GETB().
The PNM_ASSIGN1 macro assigns a single value to an xel, when you know it's from a PBM or PGM file. When
it's from a PPM file, use PPM_ASSIGN.
The PNM_EQUAL macro checks two xels for equality. The PNM_FORMAT_TYPE macro computes a format type code
from a format code. The format types are PBM, PGM, PPM, and PAM. But note that PBM, PGM, and PPM each
are two different formats: a plain one and a raw one. So there are four format types, but seven formats.
PNM_FORMAT_TYPE does not work on the PAM format code.
pnm_whitexel() and pnm_blackxel() return a white or black xel, respectively, for the given maxval and
format.
pnm_invertxel() inverts an xel.
INITIALIZATIONpnm_init() is obsolete (at least since Netpbm 9.25 (March 2002)). Use pm_proginit() instead.
pnm_init() is identical to pm_proginit.
MEMORYMANAGEMENTpnm_allocarray() allocates space for an array of xels. pnm_freearray() frees an array space allocated by
pnm_allocarray() or pnm_readpnm().
pnm_allocrow() allocates space for a row of a PNM image. pnm_freerow() frees it.
READINGPNMFILESpnm_readpnminit() is similar to pnm_readpaminit(), but reads only PNM images and has a different
parameter list.
pnm_readpnmrow() is similar to pnm_readpamrow() but only works on PNM images and has a different
parameter list and returns the row as an array of xels instead of tuples.
pnm_readpnm() is similar to pnm_readpam() except that it reads only PNM images and uses a different
parameter list and returns an array of rows such that pnm_readpnmrow() would return rather than such that
pnm_readpamrow() would return.
WRITINGFILESpnm_writepnminit() is similar to pnm_writepaminit() except that it can write only a PNM header and has a
different parameter list.
forceplain is a binary value. True (nonzero) means to write the image in the plain (ASCII) version of
the selected format. False (zero) means to write it in the raw (binary) version of the selected format.
See PNMformatspecification(1).
pnm_writepnmrow() is similar to pnm_writepamrow() except that it works only on PNM images and has a
different parameter list and takes an array of xels instead of an array of tuples. See the description
of forceplain above.
pnm_writepnm() is similar to pnm_writepam() except that it works only on PNM image, has a different
parameter list, and takes an array of rows of xels instead of an array of rows of tuples. See the
description of forceplain above.
FORMATPROMOTIONpnm_promoteformatrow() promotes a row of xels from one maxval and format to a new set. Use this when you
are combining multiple anymaps of different types - just take the maximum of the maxvals and the maximum
of the formats, and promote them all to that.
pnm_promoteformat() promotes an entire anymap.
MISCELLANEOUSpnm_nextimage() positions a PNM input file to the next image in it (so that a subsequent
pnm_readpnminit() reads its header).
pnm_nextimage() is analogous to pbm_nextimage(), but works on PPM, PGM, and PBM files.
pnm_check() is similar to pnm_checkpam() except it works only on PNM images.
pnm_check() is identical to ppm_check().
pnm_backgroundxelrow() figures out an appropriate background xel based on the row of xels xelrow, which
is cols xels wide, has maxval maxval, and represents an image with format format.
This estimate works best when the row is the top or bottom row of the image.
pnm_backgroundxel() does the same thing as pnm_backgroundxelrow(), except based on an entire image
instead of just one row. This tends to do a slightly better job than pnmbackgroundxelrow().
Document Source
This manual page was generated by the Netpbm tool 'makeman' from HTML source. The master documentation
is at
http://netpbm.sourceforge.net/doc/libpnm.html
netpbm documentation 08 September 2007 Usermanualforoldpnmfunctions(3)
Name
libpnm - libnetpbm functions to read and write PNM image files
See Also
Libnetpbm(1), LibnetpbmUser'sGuide(1), LibnetpbmDirectory(1), pbm(1), pgm(1), ppm(1), pam(1), libpbm(1), libpgm(1), libppm(1)
Synopsis
#include<netpbm/pnm.h>voidpnm_init(int*argcP,char*argv[]);xel**pnm_allocarray(intcols,introws);xel*pnm_allocrow(intcols);voidpnm_freearray(xel**xels,introws);voidpnm_freerow(xel*xelrow);voidpnm_readpnminit(FILE*fp,int*colsP,int*rowsP,xelval*maxvalP,int*formatP);voidpnm_readpnmrow(FILE*fp,xel*xelrow,intcols,xelvalmaxval,intformat);xel**pnm_readpnm(FILE*fp,int*colsP,int*rowsP,xelval*maxvalP,int*formatP);voidpnm_writepnminit(FILE*fp,intcols,introws,xelvalmaxval,intformat,intforceplain);voidpnm_writepnmrow(FILE*fp,xel*xelrow,intcols,xelvalmaxval,intformat,intforceplain);voidpnm_writepnm(FILE*fp,xel**xels,intcols,introws,xelvalmaxval,intformat,intforceplain);voidpnm_nextimage(FILE*file,int*consteofP);voidpnm_check(FILE*file,constenumpm_check_typecheck_type,constintformat,constintcols,constintrows,constxelvalmaxval,enumpm_check_code*retvalP);voidpnm_promoteformatrow(xel*xelrow,intcols,xelvalmaxval,intformat,xelvalnewmaxval,intnewformat);voidpnm_promoteformat(xel**xels,intcols,xelvalmaxval,intformat,xelvalnewmaxval,intnewformat);xelpnm_whitexel(xelvalmaxval,intformat);xelpnm_blackxel(xelvalmaxval,intformat);voidpnm_invertxel(xel*x,xelvalmaxval,intformat);xelpnm_backgroundxelrow(xel*xelrow,intcols,xelvalmaxval,intformat);xelpnm_backgroundxel(xel**xels,intcols,introws,xelvalmaxval,intformat);typedef...xelval;typedef...xel;#definePNM_ASSIGN1(x,v)...#definePNM_GET1(x)...#definePNM_EQUAL(x,y)...#definePNM_FORMAT_TYPE(format)...
