read.bitmap: Read in a bitmap image in JPEG, PNG, BMP or TIFF format

Description Usage Arguments Value See Also Examples

View source: R/read-any-bitmap.R

Description

By default uses magic bytes at the start of the file to identify the image type (rather than the file extension). Currently uses readers in bmp, jpeg, png, and tiff packages.

Usage

1
read.bitmap(f, channel, IdentifyByExtension = FALSE, ...)

Arguments

f

Path to image file

channel

Integer identifying channel to return for an RGB image

IdentifyByExtension

Identify by file extension only (Default FALSE)

...

Additional parameters passed to underlying image readers

Value

Objects returned by readJPEG, readPNG, read.bmp, or readTIFF. See their documentation for details.

See Also

image_type, readJPEG, readPNG, read.bmp, readTIFF

Examples

1
2
3
4
5
img1=read.bitmap(system.file("img", "Rlogo.jpg", package="jpeg"))
str(img1)
img2 <- read.bitmap(system.file("img", "Rlogo.png", package="png"))
# nb the PNG image has an alpha channel
str(img2)

Example output

 num [1:76, 1:100, 1:3] 1 1 1 1 1 1 1 1 1 1 ...
 num [1:76, 1:100, 1:4] 0 0 0 0 0 0 0 0 0 0 ...

readbitmap documentation built on May 1, 2019, 8:47 p.m.