image_type: Identify the type of an image using the magic value at the...

Description Usage Arguments Value Examples

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

Description

Currently works for png, jpeg and BMP images. Will seek to start of file if passed a connection. For details of magic values for files, see e.g. http://en.wikipedia.org/wiki/Magic_number_(programming)#Magic_numbers_in_files

Usage

1
image_type(source, Verbose = FALSE)

Arguments

source

Path to file or connection

Verbose

Whether to write a message to console on failure (Default F)

Value

character value corresponding to standard file extension of image format (i.e. jpg, png, bmp) or NA_character_ on failure.

Examples

1
2
3
4
5
6
jpegfile=system.file("img", "Rlogo.jpg", package="jpeg")
image_type(jpegfile)
jpeg_pretending_to_be_png=tempfile(fileext = '.png')
file.copy(jpegfile, jpeg_pretending_to_be_png)
image_type(jpeg_pretending_to_be_png)
unlink(jpeg_pretending_to_be_png)

readbitmap documentation built on May 30, 2017, 7:52 a.m.

Search within the readbitmap package
Search all R packages, documentation and source code