# Module `rasterio` - Support for saving and loading rasters as graphics files

Support for saving and loading rasters as graphics files.

## Index

- Process `read.raster` - Load an image file as a raster, with the format determined automatically based on the extension
- Process `read.raster.png` - Load a PNG file as a raster
- Process `read.raster.ppm` - Load a PPM file as a raster
  - Process `get.char` - Read a character from the file into ch, skipping comments
  - Process `get.number` - Read a decimal number terminated by a single whitespace character from the file into n, skipping any preceding whitespace
  - Function `is.whitespace` - Is a character whitespace, as defined by the PPM spec?
  - Process `raw.char` - Read a character from the file into ch
- Process `write.raster` - Write a raster to a file, with the format determined automatically based on the extension
- Process `write.raster.png` - Write a raster out as a PNG file
- Process `write.raster.ppm` - Write a raster out as a PPM file
- Process `write.rasters` - Write rasters to files

## Declarations

### `png.occ`:32Process `read.raster.png`

`PROC read.raster.png (VAL []BYTE filename, RESULT RASTER raster)`

Load a PNG file as a raster.

### `png.occ`:44Process `write.raster.png`

`PROC write.raster.png (VAL []BYTE filename, VAL [][]INT raster)`

Write a raster out as a PNG file.

### `ppmwrite.occ`:27Process `write.raster.ppm`

`PROC write.raster.ppm (VAL []BYTE filename, VAL [][]INT raster)`

Write a raster out as a PPM file.

### `ppmread.occ`:28Process `read.raster.ppm`

`PROC read.raster.ppm (VAL []BYTE filename, RESULT RASTER raster)`

Load a PPM file as a raster.

### `ppmread.occ`:35Function `is.whitespace`

`BOOL FUNCTION is.whitespace (VAL BYTE ch)`

Is a character whitespace, as defined by the PPM spec?

### `ppmread.occ`:48Process `raw.char`

`PROC raw.char ()`

Read a character from the file into ch.

### `ppmread.occ`:58Process `get.char`

`PROC get.char ()`

Read a character from the file into ch, skipping comments.

### `ppmread.occ`:76Process `get.number`

`PROC get.number (RESULT INT n)`

Read a decimal number terminated by a single whitespace character from the file into n, skipping any preceding whitespace.

### `rasterio.occ`:39Process `read.raster`

`PROC read.raster (VAL []BYTE filename, RESULT RASTER raster)`

Load an image file as a raster, with the format determined automatically based on the extension.

The following extensions are currently supported:

- `.png` (if your occam system was built with PNG support)
- `.ppm`

### `rasterio.occ`:59Process `write.raster`

`PROC write.raster (VAL []BYTE filename, VAL [][]INT raster)`

Write a raster to a file, with the format determined automatically based on the extension.

The following extensions are currently supported:

- `.png` (if your occam system was built with PNG support)
- `.ppm`

### `rasterio.occ`:83Process `write.rasters`

`PROC write.rasters (VAL []BYTE prefix, suffix, CHAN RASTER in?, out!)`

Write rasters to files.

As each raster passes through, it's written to a file named `prefix000000suffix`, with the number incrementing by one for each frame. The files can be in any format supported by `write.raster`.

You can convert the resulting files into a video using `mencoder` or a similar tool; see the mencoder manual for more details.