Learn R Programming

readbitmap (version 0.1.5)

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

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

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

Run this code
# NOT RUN {
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)
# }

Run the code above in your browser using DataLab