Graphics | ![]() ![]() |
Writing a Graphics Image
When you save an image using imwrite
, MATLAB's 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 MATLAB's rule for saving the image data as uint8
is that PNG and TIFF images may be saved as uint16
. Since these two formats support 16-bit data, you may override MATLAB's default behavior by specifying uint16
as the data type for imwrite
. The following example shows writing a 16-bit PNG file using imwrite
.
imwrite(I,'clown.png','BitDepth',16);
![]() | Reading a Graphics Image | Obtaining Information About Graphics Files | ![]() |