# im2double

Convert image to double precision.

## 📝 Syntax

* IM = im2double(I)
* IM = im2double(I,'indexed')

## 📥 Input argument

* I - Input image: scalar, vector, matrix or multidimensional array with type single, double, int16, uint8, uint16 or logical.

## 📤 Output argument

* IM - The converted image is returned as a numeric array with the same dimensions as the input image I with type double.

## 📄 Description

IM = im2double(I) converts the input image I to double precision format. The input image IM can be a grayscale, truecolor, or binary image. When converting, im2double rescales the pixel values from their original integer format to a floating-point range of \[0, 1].

For an indexed image, IM = im2double(I, 'indexed') converts the image I to double precision as well, but with an added offset of 1 to the pixel values during the conversion from integer types.

## 💡 Example

```matlab
I = reshape(uint8(linspace(1,255,25)),[5 5]);
IM1 = im2double(I)
IM2 = im2double(I, 'indexed')

```

## 🔗 See also

[double](https://nelson-9.gitbook.io/Nelson/markdown/en/double/double), [imread](https://nelson-9.gitbook.io/Nelson/markdown/en/graphics_io/imread).

## 🕔 History

| Version | 📄 Description  |
| ------- | --------------- |
| 1.0.0   | initial version |
