write.image {adimpro}R Documentation

I/O Functions


Write an image file.


write.image(img, file = "tmp.ppm", max.x=NULL, max.y=NULL, depth = NULL, gammatype="ITU", 
        whitep = NULL, temp = NULL, cspace = NULL, black = 0, exposure = 1)



image data, an object of class "adimpro".


file name, the extension determines the image file format.


maximum value of pixels in x dimension.


maximum value of pixels in y dimension.


color depth, either 8 or 16 (bit)! The value is reset to 8 if the specified image file format does not allow for 16 Bit encoding.


character, determines the type of gamma correction within the image. "ITU" stands for ITU-R BT.709-3 as e.g. used by dcraw. Alternatives recognized within the package are "None", "sRGB" and "CIE" (CIE L*). NULL keeps the actual setting. gammatype="histogram" forces histogram equalization based on the corresponding greyvalue image.


defines the output color space, default is img$cspace can be set to "sRGB", "Adobe" (Adobe 1998), "wGamut" (Wide Gamut), "kodak" (Kodak ProPhoto) "xyz", "yuv", "yiq" and "hsi"


White point in xyY space. Can be given as one of (character) c("A","B","C","E","D50","D55","D65","D75","F2","F7","F11") or as a two element numeric vector of chromatic xy coordinates. "D65" corresponds to the default white point of "sRGB" and "Adobe" RGB-spaces. NULL keeps the actual setting.


Color temperature. Can be used to specify chromatic xy coordinates of the whitepoint. Only used if is.null(whitep).


Adjustment for black color. Color values with luminance <= black will be assigned to black in RGB. Adjustment ist done in xyY space.


Multiplicative factor for all color channels (in xyz or rgb spaces). Applied in linear color space, i.e. if the image is gamma corrected the gamma correction is reversed first.


This function writes the image data in img to the file file. Color depth depth is used for writing, but if image has a component "depth", this argument will be ignored. Note: Not all target formats support 16bit coding. The target format is determined from the file extension, and should be one of the many that ImageMagick supports.

Note that write image by default applies a gamma correction with gammatype="ITU". This provides a good standard for display on a screen. For printing cspace="Adobe" should be prefered. Images that are intended for further editing should preferably be saved in an image format that allows for 16Bit depth (tiff, png) using either cspace="Adobe", cspace="wGamut" or cspace="kodak" and preferably no gamma correction to prevent from additional loss of information.


Nothing is returned.


ImageMagick has to be installed on the system to write "tif", "tiff", "png", "gif", "jpg" or "jpeg" files.


Karsten Tabelow tabelow@wias-berlin.de and Joerg Polzehl polzehl@wias-berlin.de

See Also

read.image, adjust.image


## Not run: demo(io)

[Package adimpro version 0.9.3 Index]