Skip to contents

IFFChunk()s represent the structure of the Interchange File Format well, but the iformation is stored as raw data. This method tries to interpret and translate the information into a more comprehensive format.

Usage

# S4 method for IFFChunk
interpretIFFChunk(x, ...)

Arguments

x

An IFFChunk() object which needs to be interpreted.

...

Currently ignored.

Value

If x is interpretable by this package an S3 class object of IFF.ANY is returned. The content of the returned object will depend on the type of IFFChunk() provided for x. The result can for instance be a raster image (grDevices::as.raster()), a list of audio tuneR::Wave()s, a character string or a named list.

Details

Interchange File Format chunks can hold any kind of information (images, audio, (formatted) text, etc.). This method will try to convert this information into something useful. Information may get lost in the translation, so be careful when converting back to an IFFChunk-class() object using IFFChunk-method().

An error is thrown when the IFFChunk() object is currently not interpretable by this package. See IFFChunk-method() for an overview of currently supported IFF chunks. This list may increase while this package matures.

Author

Pepijn de Vries

Examples

if (FALSE) {
## load an IFF file
example.iff <- read.iff(system.file("ilbm8lores.iff", package = "AmigaFFH"))

## in this case, the file is a FORM container with a bitmap image, and a
## list with a raster object is returned when interpreted:
example.itpt <- interpretIFFChunk(example.iff)
class(example.itpt)
typeof(example.itpt)
class(example.itpt[[1]])

## Let's extraxt the bitmap header from the main chunk:
bmhd <- getIFFChunk(example.iff, c("ILBM", "BMHD"))

## When interpreted, a named list is returned with (meta-)information
## on the bitmap image:
bmhd.itpt <- interpretIFFChunk(bmhd)
class(bmhd.itpt)
typeof(bmhd.itpt)
print(bmhd.itpt)
}