diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2006-08-19 03:12:28 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2006-08-19 03:12:28 +0000 |
commit | 1fd361a1ea06e44286c213ca1f814f49306fdc43 (patch) | |
tree | 64c8c96cf54d8718847339a403e5e67b922e8c3f /converter/ppm/ppmtoppm.c | |
download | netpbm-mirror-1fd361a1ea06e44286c213ca1f814f49306fdc43.tar.gz netpbm-mirror-1fd361a1ea06e44286c213ca1f814f49306fdc43.tar.xz netpbm-mirror-1fd361a1ea06e44286c213ca1f814f49306fdc43.zip |
Create Subversion repository
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@1 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'converter/ppm/ppmtoppm.c')
-rw-r--r-- | converter/ppm/ppmtoppm.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/converter/ppm/ppmtoppm.c b/converter/ppm/ppmtoppm.c new file mode 100644 index 00000000..500c9856 --- /dev/null +++ b/converter/ppm/ppmtoppm.c @@ -0,0 +1,44 @@ +/*---------------------------------------------------------------------------- + ppmtoppm +------------------------------------------------------------------------------ + Part of the Netpbm package. + + Copy PPM image from Standard Input to Standard Output + + + By Bryan Henderson, San Jose CA 2002.09.07 + + Contributed to the public domain by its author 2002.09.07 +-----------------------------------------------------------------------------*/ + +#include "ppm.h" + +int +main(int argc, char *argv[]) { + int format; + int rows, cols; + pixval maxval; + int row; + pixel* pixelrow; + + ppm_init(&argc, argv); + + if (argc-1 != 0) + pm_error("Program takes no arguments. Input is from Standard Input"); + + ppm_readppminit(stdin, &cols, &rows, &maxval, &format); + + ppm_writeppminit(stdout, cols, rows, maxval, 0); + + pixelrow = ppm_allocrow(cols); + + for (row = 0; row < rows; row++) { + ppm_readppmrow(stdin, pixelrow, cols, maxval, format); + ppm_writeppmrow(stdout, pixelrow, cols, maxval, 0); + } + ppm_freerow(pixelrow); + + pm_close(stdin); + + exit(0); +} |