write.BitmapImage {R.image}R Documentation

Writes the image to a file

Description

Writes the image to a file in either BMP (Windows Bitmap, buggy???), EPS (Encapsulated Postscript), JPEG (Joint Photographic Experts Group), PNG (Portable Network Graphics), PPM (Portable PixMap) or RGB (Red Green Blue) format.

Note that when saving in RGB format the image dimension is lost, since the RGB format only contains the red, green and blue pixel values of the image and not the size of it.

Internally writeBMP(), writeEPS(), writeJPG(), writePNG(), writePPM() and writeRGB() are used, respectively.

Usage

## S3 method for class 'BitmapImage':
write(this, filename, format=NULL, ...)

Arguments

filename The name of the image file.
format File format of the image. If ppm, a Portable PixMap file is written. If rgb, an RGB file is written, if jpg a JPEG file is written and if png and PNG file is written. If NULL, then filename extension will be used as the format.
... Other values accepted by the underlying saving methods. For more details see RGBImage.writePPM and RGBImage.writeRGB.

Author(s)

Henrik Bengtsson (http://www.braju.com/R/)

See Also

For reading an image from file see *read(). For more information see BitmapImage.

Examples

   # Read the images 'logosm.ppm' of size 51x38.
   logo <- BitmapImage$read("logosm.ppm", path=system.file("images", package="R.image"))

   write(logo, "logosm2.bmp")
   write(logo, "logosm2.jpg")
   write(logo, "logosm2.rgb")
   write(logo, "logosm2.png")
   write(logo, "logosm2.ppm")
   write(logo, "logosm2a.ppm", ascii=TRUE)
 

[Package R.image version 0.2.3 Index]