rasterToIFF: Convert a grDevices raster image into an IFF formated bitmap...

View source: R/iff.ilbm.r

rasterToIFFR Documentation

Convert a grDevices raster image into an IFF formated bitmap image

Description

Convert grDevices raster images (grDevices::as.raster()) into a formal IFFChunk() object, as an interleaved bitmap (ILBM) image.

Usage

rasterToIFF(
  x,
  display.mode = as.character(AmigaFFH::amiga_display_modes$DISPLAY_MODE),
  monitor = as.character(AmigaFFH::amiga_monitors$MONITOR_ID),
  anim.options,
  ...
)

Arguments

x

A raster object created with grDevices::as.raster() which needs to be converted into an IFF formated bitmap image. It is also possible to let x be a matrix of characters, representing colours.

display.mode

Specify the Amiga display mode that should be used. See amiga_display_modes() for all possible options. "LORES_KEY" is used by default, this is the lowest resolution possible on the Amiga.

monitor

The Amiga monitor on which the needs to be displayed. See amiga_monitors() for more details and posible options. By default "DEFAULT_MONITOR_ID" is used.

anim.options

Currently ignored. This argument will potentitally be implemented in future versions of this package. Currently, animations are always encoded with the "ByteVerticalCompression" in this package (when x is a list of raster objects).

...

Arguments passed on to rasterToBitmap().

Details

Convert any modern image into a interleaved bitmap (image) conform Interchange File Format (IFF) specifications. If your original image is in true colour (i.e., a 24 bit colour depth) it will be converted into a bitmap image with an indexed palette.

Value

Returns an IFFChunk() object holding an Interleaved Bitmap (ILBM) image based on x.

Author(s)

Pepijn de Vries

See Also

Other iff.operations: IFFChunk-class, WaveToIFF(), as.raster.AmigaBasicShape(), getIFFChunk(), interpretIFFChunk(), rawToIFFChunk(), read.iff(), write.iff()

Other raster.operations: AmigaBitmapFont, as.raster.AmigaBasicShape(), bitmapToRaster(), dither(), index.colours(), rasterToAmigaBasicShape(), rasterToAmigaBitmapFont(), rasterToBitmap(), rasterToHWSprite()

Examples

## Not run: 
## first: Let's make a raster out of the 'volcano' data, which we can use in the example:
volcano.raster <- as.raster(t(matrix(terrain.colors(1 + diff(range(volcano)))[volcano -
  min(volcano) + 1], nrow(volcano))))

## Turning the raster into an IFFChunk object is easy:
volcano.iff <- rasterToIFF(volcano.raster)

## This object can be saved as an IFF file using write.iff

## in special modes HAM6 and HAM 8 higher quality images
## can be obtained. See 'rasterToBitmap' for more info on the
## special HAM modes.
volcano.ham <- rasterToIFF(volcano.raster, "HAM_KEY", depth = "HAM8")

## The result can be further improved by applying dithering
volcano.ham.dither <- rasterToIFF(volcano.raster, "HAM_KEY", depth = "HAM8",
  indexing = function(x, length.out) {
    index.colours(x, length.out, dither = "JJN", iter.max = 20)
  })

## End(Not run)

AmigaFFH documentation built on June 22, 2024, 11:03 a.m.