Description Usage Arguments Details Value Author(s) See Also Examples
Reading and writing of bitmap images in PBM (black/white), PGM (grey) and PPM (color) format.
1 2 |
file |
name of the pnm file (general
|
... |
further arguments passed to |
object |
an object of class |
forceplain |
logical; if true, an ASCII pnm file is written. Default is to write a binary (raw) file. |
type |
one of |
maxval |
the maximum color-component value; the default is a colour depth of 8 bits, i.e., the integer 255. |
read.pnm
reads a pnm file and loads the image into an
object of class pixmap
.
write.pnm
writes an object of class pixmap
to a
pnm file, the type
argument controls wheter the written image
file is a black-and-white bitmap (pbm), grey (pgm) or color (ppm).
plot.pnm
plots a pnm object using the command
image
. The only difference is that the element [1,1]
of
pnmobj
is plotted as the upper left corner (plain
image
would plot [1,1]
as the lower left corner.
read.pnm
returns an object of class pixmapRGB
for color
pixmaps (ppm), and an object of class pixmapGrey
for pbm
and pgm. Note that the type of file as determined by the first
two bytes according to pnm standards is important, not the
extension of the file. In fact, the file name extension is
completely ignored.
Roger Bivand and Friedrich Leisch
1 2 3 4 5 6 7 8 9 | x <- read.pnm(system.file("pictures/logo.ppm", package="pixmap")[1])
plot(x)
print(x)
x <- read.pnm(system.file("pictures/logo.pgm", package="pixmap")[1])
plot(x)
x <- read.pnm(system.file("pictures/logo.pbm", package="pixmap")[1])
plot(x)
|
Warning message:
In rep(cellres, length = 2) : 'x' is NULL so the result will be NULL
Pixmap image
Type : pixmapRGB
Size : 77x101
Resolution : 1x1
Bounding box : 0 0 101 77
Warning message:
In rep(cellres, length = 2) : 'x' is NULL so the result will be NULL
Warning message:
In rep(cellres, length = 2) : 'x' is NULL so the result will be NULL
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.