| Image Processing Toolbox | ![]() |
Convert image array to 8-bit unsigned integers
Syntax
Description
im2uint8 takes an image as input and returns an image of class uint8. If the input image is of class uint8, the output image is identical to it. If the input image is of class logical, uint16, or double, im2uint8 returns the equivalent image of class uint8, rescaling or offsetting the data as necessary.
I2 = im2uint8(I) converts the intensity image I to uint8, rescaling the data if necessary.
RGB2 = im2uint8(RGB) converts the true-color image RGB to uint8, rescaling the data if necessary.
I = im2uint8(BW) converts the binary image BW to a uint8 intensity image, changing 1-valued elements to 255
X2 = im2uint8(X,'indexed') converts the indexed image X to uint8, offsetting the data if necessary. Note that it is not always possible to convert an indexed image to uint8. If X is of class double, max(X(:)) must be 256 or less; if X is of class uint16, max(X(:)) must be 255 or less. To convert a uint16 indexed image to uint8 by reducing the number of colors, use imapprox.
See Also
im2uint16, double, im2double, uint8, imapprox, uint16
| im2uint16 | imabsdiff | ![]() |
Learn more about the latest releases of MathWorks products: |
| © 1994-2009 The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |