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


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


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



A raster object created with 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.


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.


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.


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.


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.


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


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()


## 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 Aug. 27, 2023, 9:07 a.m.