Graphics Previous page   Next Page

Writing a Graphics Image

When you save an image using imwrite, the default behavior is to automatically reduce the bit depth to uint8. Many of the images used in MATLAB are 8-bit, and most graphics file format images do not require double-precision data. One exception to the MATLAB rule for saving the image data as uint8 is that PNG and TIFF images can be saved as uint16. Because these two formats support 16-bit data, you can override the MATLAB default behavior by specifying uint16 as the data type for imwrite. The following example shows writing a 16-bit PNG file using imwrite.


Previous page  Reading a Graphics Image Obtaining Information About Graphics Files Next page

© 1994-2005 The MathWorks, Inc.