DIPlib Documentation - ©1995-2015 Quantitative Imaging Group, Delft University of Technology.

# ImageRead

Read grey-value image from file (in dipIO)

## SYNOPSIS

dip_Error dipio_ImageRead ( image, filename, format, addExtensions, recognised )

## FUNCTION

This function reads an image from a file and puts it in `image`. `image` must be allocated before calling this function. If `format` is 0, all different `ImageRead` functions are called in sequence until the correct format has been found. If you know the format, get the correct format ID through the registry functions. See File formats recognized by dipIO for a list of currently supported formats.

The boolean `addExtensions` specifies whether `ImageRead` should try to add file format extensions to `filename`, if the registered file format reader fails to recognise `filename` straight away. The extensions are provided by the registered file readers.

If `recognised` is not zero, `ImageRead` will set it to `DIP_TRUE` when it has been able to read `filename`, and it will set it to `DIP_FALSE` when it is not able to read the file. No error will be generated in this case.

If the file contains a colour image, `Colour2Gray` is called. That is, this function always returns a grey-value image.

## ARGUMENTS

Data type | Name | Description
`dip_Image` | `image` | Output image
`dip_String` | `filename` | File name
`dip_int` | `format` | ID of file format
`dip_Boolean` | `addExtensions` | Add file format extensions to `filename`
`dip_Boolean *` | `recognised` | Pointer to boolean containing the file read status

## SEE ALSO

`ImageReadColour`, `ImageReadROI`, `ImageFileGetInfo`, `ImageReadCSV`, `ImageReadGIF`, `ImageReadICS`, `ImageReadJPEG`, `ImageReadLSM`, `ImageReadPIC`, `ImageReadPNG`, `ImageReadTIFF`, `ImageWrite`, `Colour2Gray`