SIVP Toolbox
Last update : Oct, 2006
imwrite - Write image to file
Calling Sequence
- ret=imwrite(im, filename)
Parameters
-
im:im can be an M-by-N (greyscale image) or M-by-N-by-3 (color image) matrix.
If im is not of class uint8, imwrite will convert the datatype before writing using im2uint8(im).
-
filename:
A string that specifies the name of the output file.
-
ret:
Return value. If the image is successfully writed into a file, ret will be 1.
Description
imwrite writes a matrix into a image file. The format of the file is inferred from the extension in the filename parameter. Currently the following file formats are supported:
-
* Windows bitmaps - BMP, DIB;
-
* JPEG files - JPEG, JPG, JPE;
-
* Portable Network Graphics - PNG;
-
* Portable image format - PBM, PGM, PPM;
-
* Sun rasters - SR, RAS;
-
* TIFF files - TIFF, TIF.
Examples
im=rand(200,300);
ret = imwrite(im, 'rand.png');
Authors
-
Shiqi Yu <shiqi.yu[at]gmail.com>
Bugs and Shortcomings
Images with a palette are not supported.
Availability
The latest version of SIVP can be found at
http://sivp.sourceforge.net
See Also
imread, imshow, imfinfo,