7.3.2. Reading/Writing PPM/PGM/PBM Image Files
|
(lsh/libimage/pnm.lsh) |
Routines for reading and writing PBM/PGM/PPM image files into/from idx.
Another set of functions built on top of these is used to read/write
image files in other formats than PPM/PGM/PBM.
7.3.2.0. (pnm-header f)
|
(lsh/libimage/pnm.lsh) |
((-gptr- "FILE *") f):
Return the descriptive string of a PNM image file
(P6, P4, or P5), and skip the file descriptor
past the comments.
7.3.2.1. (mmap-idx3-storage f u d0 d1 d2)
|
(lsh/libimage/pnm.lsh) |
((-gptr- "FILE *") f):
((-idx3- (-ubyte-)) u):
((-int-) d0 d1 d2):
Maps file f (at the current position given by FTELL) into idx3 u
does not check that f size is OK.
7.3.2.2. (mmap-idx2-storage f u d0 d1)
|
(lsh/libimage/pnm.lsh) |
((-gptr- "FILE *") f):
((-idx2- (-ubyte-)) u):
((-int-) d0 d1):
Maps file f (at the current position given by FTELL) into idx2 u
does not check that f size is OK.
7.3.2.3. (pnm-fread-into-rgbx f out)
|
(lsh/libimage/pnm.lsh) |
((-gptr- "FILE *") f):
read an image from a PBM/PGM/PPM file into an idx3 of ubytes (RGB or
RGBA). f must be a valid file
descriptor (C pointer). out is
appropriately resized if required. The last dimension is left unchanged
but must be at least 3. Appropriate conversion is performed. extra color
components (beyond the first 3) are left untouched.
See: pnm
7.3.2.4. (pnm-read-into-rgbx f out)
|
(lsh/libimage/pnm.lsh) |
read a PBM/PGM/PPM file into an idx3 of ubytes. The output idx is
appropriately resized if necessary. The last dimension must be at least
3.
7.3.2.5. (pnm-fread-rgb f)
|
(lsh/libimage/pnm.lsh) |
((-gptr- "FILE *") f) f must be an
open file descriptor. read a PBM/PGM/PPM file and return an idx3 of
ubytes with the image in it. Conversion to RGB is performed if
necessary.
7.3.2.6. (pnm-read-rgb s)
|
(lsh/libimage/pnm.lsh) |
read a PBM/PGM/PPM file and return an idx3 of ubytes with the image in
it. Conversion to RGB is performed if necessary.
7.3.2.7. (pnm-fread-rgba f)
|
(lsh/libimage/pnm.lsh) |
((-gptr- "FILE *") f) f must be an
open file descriptor. read a PBM/PGM/PPM file and return an idx3 of
ubytes with the image in it. Conversion to RGB is performed if
necessary. The alpha channel is set to 0.
7.3.2.8. (pnm-read-rgba s)
|
(lsh/libimage/pnm.lsh) |
read a PBM/PGM/PPM file and return an idx3 of ubytes with the image in
it. Conversion to RGBA is performed if necessary. The alpha channel is
set to 0.
7.3.2.9. (pnm-fread-into-ubim f out)
|
(lsh/libimage/pnm.lsh) |
((-gptr- "FILE *") f):
((-idx2- (-ubyte-)) out):
read an image from a PBM/PGM/PPM file into an idx2 of ubytes (one byte
per pixel). f must be a valid file
descriptor (C pointer). out is
appropriately resized if required. Appropriate conversion is performed
(e.g. if the file contains an RGB image).
7.3.2.10. (pnm-read-into-ubim f out)
|
(lsh/libimage/pnm.lsh) |
read a PBM/PGM/PPM file into an idx2 of ubytes (greyscale image). The
output idx is appropriately resized if necessary. Appropriate
conversions to greyscale are performed
7.3.2.11. (pnm-fread-ubim f)
|
(lsh/libimage/pnm.lsh) |
((-gptr- "FILE *") f) f must be an
open file descriptor. read a PBM/PGM/PPM file and return an idx2 of
ubytes with the image in it. Conversion to greyscale is performed if
necessary.
7.3.2.12. (pnm-read-ubim f)
|
(lsh/libimage/pnm.lsh) |
read a PBM/PGM/PPM file and return an idx2 of ubytes with the image in
it. Conversion to greyscale is performed if necessary.
7.3.2.13. (ppm-mmap f)
|
(lsh/libimage/pnm.lsh) |
((-gptr- "FILE *") f):
maps a ppm RGB image (file descriptor <f>)
into memory and return an idx3 of ubytes
with the data.
7.3.2.14. (pgm-mmap f)
|
(lsh/libimage/pnm.lsh) |
((-gptr- "FILE *") f):
maps a pgm image (file descriptor <f>)
into memory and return an idx2 of ubytes
with the data.
7.3.2.15. (ppm-fwrite-rgb f m)
|
(lsh/libimage/pnm.lsh) |
writes RGB image m in file descriptor
f as a PPM/PPM file. m is
and idx3 of ubytes. f must be a file
descriptor.
7.3.2.16. (ppm-write-rgb f m)
|
(lsh/libimage/pnm.lsh) |
writes RGB image m in file
f as a PPM/PPM file. m is
and idx3 of ubytes.
7.3.2.17. (pgm-fwrite-ubim f m)
|
(lsh/libimage/pnm.lsh) |
writes an ubimage m in file
f as a PGM file. m is and
idx2 of ubytes, and f is an open file
descriptor.
7.3.2.18. (pgm-write-ubim f m)
|
(lsh/libimage/pnm.lsh) |
writes greyscale ubimage m in file
f as a PGM file. m is and
idx2 of ubytes.