read.picture {SoPhy} | R Documentation

## Reading TIF pictures and conversion to RGB matrix

### Description

The function reads in TIF formated pictures and returns an RGB-A matrix, where A is the associated alpha matting information, if there is any (and identically 255 otherwise). If the format is different from TIF, it is first convert-ed to TIF.

### Usage

    read.picture(picture, extensions=c("tif", "tiff",
                          if (.Platform$OS.type=="unix") c("gif", "jpeg")),
                 PrintLevel=RFparameters()$Print, tmp.dir=".")

### Arguments

`picture` | name of the graphic file, see details
`extensions` | standard extensions for the graphic file
`PrintLevel` | <=0 : no messages are printed >0 : the higher the number the more information is given.
`tmp.dir` | NULL or character. The variable is used if the picture file does not end with ‘tif’ or ‘tiff’. Then the picture file is converted into a tif file before being read in. The storage path is given by `tmp.dir`. An existing tif file in `tmp.dir` is not overwritten, but this file used instead and a warning is given.

### Details

The procedure of finding the graphic is the following.

- if the file is given with one of the standard extension, it is assumed that this file is wanted
- else it is assumed that only the base name was given. Then, as above, the standard extensions are added sequentially.
- else the algorithm fails

If the file is neither TIF nor TIFF it is first convert-ed.

### Value

three-dimensional array, where the first two dimensions are the dimensions of the graphic, and the third dimension has length 4, for red, green, blue and alpha.

### Author(s)

Martin Schlather, schlath@hsu-hh.de http://www.unibw-hamburg.de/WWEB/math/schlath/schlather.html

### See Also

`plotRGB, `write.picture``

### Examples

    fig <- read.picture(paste(system.file(package='SoPhy'),
                        'tracer', 'K06', sep="/"), Pr=3)
    plotRGB(fig)

[Package SoPhy version 1.0.28 Index]