Image File I/O

"vision/pbmfile" defines functions to transfer image data between EusLisp and disk files. EusLisp can read and write pgm (portable gray-scale map) and ppm (portable pixmap) format files.



read-pnm f &optional buf0 buf1 buf2 [function]

reads a pgm or ppm file specified by file-stream f and returns a pixel-image or color-pixel-image object. The image file can be either in ascii (P2 and P3) or in binary (P5 and P6) format.


read-pnm-file file &optional buf0 buf1 buf2 [function]
reads a pgm or ppm file specified by filename file.


write-pgm f image &optional (depth 255) [function]

writes a pixel-image specified by image into f file-stream in the binary ppm format.


write-ppm f image &optional (depth 255) [function]
writes a pixel-image specified by image into f file-stream in the binary pgm format.


write-pnm f img [function]
writes a pixel-image specified by img into f file-stream. If img is pixel-image, it is written in the binary pgm format. If img is color-pixel-image, written in the binary ppm format.


write-pnm-file file img [function]
writes the pixel-image specified by img into file.


image::read-raw-image file &optional (x 256) (y x) [function]
reads a raw-image file and returns a one-dimensional byte-vector (string). The dimensions of the raw-image must match with give x and y.


image::write-raw-image file imgvec [function]
writes pixel-values stored in a byte vector (string), imgvec, in file.


k-okada 2013-05-21