Name

WriteImage — saves an image file

Calling Sequence

WriteImage(Image, FilePath);

Parameters

Image

2D or 3D matrix of type uint8, uint16, uint32, double or boolean

ImagePath

name or complete path of the image file

Description

This function saves an image as a file. The image is saved as a three or single channel image of type uint8.

If Image is of type double or boolean, the gray or color values are scaled to the interval 0 - 255.

If image is of type uint16 or uint32 and the maximum gray or color value is below or equal to 255, the gray values are not modified. If the maximum gray value is greater than 255, the gray values greater than zero are scaled to the interval 1 - 255 and zero gray or color values stay zero.

Examples

OriginalImage = ReadImage('contrib\IPD-5.0\demos\teaset.png'); // image is loaded

WriteImage(OriginalImage, 'contrib\IPD-5.0\demos\copy.png'); // copy of image is saved

CopiedImage = ReadImage('contrib\IPD-5.0\demos\copy.png'); // copy is read

figure(); ShowColorImage(OriginalImage, 'Original'); // original image is displayed

figure(); ShowColorImage(CopiedImage, 'Copy'); // copy is displayed

See also

ReadImage, ReadImageFile, WriteImageFile