Next: , Previous: MAT-File Format, Up: Data Structures


7.1.9 Portable Image Files

(require 'pnm)

— Function: pnm:type-dimensions path

The string path must name a portable bitmap graphics file. pnm:type-dimensions returns a list of 4 items:

  1. A symbol describing the type of the file named by path.
  2. The image width in pixels.
  3. The image height in pixels.
  4. The maximum value of pixels assume in the file.

The current set of file-type symbols is:

pbm
pbm-raw
Black-and-White image; pixel values are 0 or 1.
pgm
pgm-raw
Gray (monochrome) image; pixel values are from 0 to maxval specified in file header.
ppm
ppm-raw
RGB (full color) image; red, green, and blue interleaved pixel values are from 0 to maxval

— Function: pnm:image-file->array path array

Reads the portable bitmap graphics file named by path into array. array must be the correct size and type for path. array is returned.

— Function: pnm:image-file->array path

pnm:image-file->array creates and returns an array with the portable bitmap graphics file named by path read into it.

— Function: pnm:array-write type array maxval path comment ...

Writes the contents of array to a type image file named path. The file will have pixel values between 0 and maxval, which must be compatible with type. For ‘pbm’ files, maxval must be ‘1’. comments are included in the file header.